How does it work?
This function is made to create an array containing every integer between 0 and the number you choose. Which means that if you choose 5
, this function will return you:
[0, 1, 2, 3, 4, 5]
How to use it?
This function will be super useful when you're dealing with these kinds of for
loop:
for (i in array) {
...
}
By the way, this for
loop can be emulated by the $.forIn()
function.
So, as an example, let's show how you can use the $.range()
function in this kind of for
loop:
JS:
for (i in $.range(10)) {
console.log(`Iteration ${i}`)
}
⚠️ Questions?
Don't hesitate to ask your questions ⁉️ in the issue part 😁