javascript number between range code example
Example 1: If statement that tests if a value is in range
if ((x >= xmin) && (x <= xmax)) {
// something
}
Example 2: range between two numbers javascript
const range = (start, end, step = 1) => {
let output = [];
if (typeof end === 'undefined') {
end = start;
start = 0;
}
for (let i = start; i < end; i += step) {
output.push(i);
}
return output;
};