reversed range using lodash

javascript, lodash, underscore.js

Solution

You have the start and stop values reversed.

console.log(_.range(3, -1, -1));
# [ 3, 2, 1, 0 ]

Alternatively you can use the chainable `reverse` function, with the `range`, like this

console.log(_.range(0, 4).reverse());
# [ 3, 2, 1, 0 ]

Note: Neither of them is similar to Python 3.x's `range` function.

Problem

Is there anything similar to python reversed range in lodash. In python ``` list(reversed(range(0, 4))) => [3, 2, 1, 0] list(reversed(range(3, 4))) => [3] ``` in lodash ``` console.log(_.range(3,4,-1)) [] console.log(_.range(0, 4, -1)); [] ```

Original source