const randomInteger = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
function range(start, end) {
if(start === end) return [start];
return [start, ...range(start + 1, end)];
}
[...Array(5).keys()] // [0, 1, 2, 3, 4]
function scale (number, inMin, inMax, outMin, outMax) {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}
if (x >= 0.001 && x <= 0.009) {
// something
}
function between(x, min, max) {
return x >= min && x <= max;
}
// ...
if (between(x, 0.001, 0.009)) {
// something
}