👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
For a long time, when writing different functions, we may want to create ranges to work with certain data. A range represents data in an array or object with a start and end value.
Many languages ‚Äã‚Äãhave built-in methods for creating ranges, for example
to_a in Ruby:
_.range () - Lodash
If we want to create a range of numbers and we want them faster possible, we can use the Lodash
_.range () util method.
This method returns an array and accepts three arguments: the first for the start of the interval, the second for the end of the interval (up) and the third for no or increased / decreased value by.
Create our function range () .
If we want to save overhead, we can create our own number range function. It turns out that creating our range is pretty straightforward.
It’s easy to write and you can avoid importing libraries like Lodash for a single function!