I have javascript code:
var newPositions = new Array(count);
for (var i = 0; i < count; i++) {
newPositions[i] = i;
}
Is it possible to init this array from 0 to count more quickly(in one-line I mean)?
upd:
count is a number that may differ in execution time
upd2: dont think about algorithm, only way to write this code in one-line.
As @Martin Jespersen suggest and using somebody deleted answer:
for (var i = 0, newPositions = []; i < count; newPositions[i] = i++)
1 Answer