Published
Edited
Jun 7, 2022
Insert cell
Insert cell
range = (start,end,step = 1) => {
if(start !== end && typeof start === "number" && typeof end === "number" && (step !== Infinity && start !== Infinity && end !== Infinity)) {
let array = []
if(start < end) {
for(let i = start; i <= end; i += step) {
array.push(i)
}
} else {
for(let j = start; j >= end; j -= step) {
array.push(j)
}
}
return array
} else {
throw new RangeError("Arguments are the same, are infinity, or not type of number.")
return undefined
}
}
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more