Just a Python learner, but what about a helper function in JS like this - you give it a start, stop, and step, and a callback function to work with the index: function range(start=0, stop=10, step=1, callback=n=>console.log(n)) { for (let i = start; i < stop; i += step) { callback(i) } } range(0, 5, 1, i => console.log(`This example is ${i}`))
for(var i = 0; i < 5,i++){ console.log(i) };
Ramda, Lodash has it
Обсуждают сегодня