I will imagine that b = 3and end = 10if I run your code and print the variables, here is what I get:
var b = 3;
var end = 10;
for (var start = b, i = 0; start < end; ++i, ++start) {
console.log(start, i);
}
> 3 0
> 4 1
> 5 2
> 6 3
> 7 4
> 8 5
> 9 6
To accomplish this with lodash (or underscore), I will first create an array with range, then iterate over it and get the index at each iteration.
Here is the result
var b = 3;
var end = 10;
var array = _.range(b, end);
_.each(array, function (value, key) {
console.log(value, key);
});
. , ( ).