I recently came across the following piece of sample code:
function range(upto) {
var result = [];
for (var i = 0; i <= upto; i++) {
result[i] = i;
}
return result;
}
and I'm confused as to why:
result[i] = i;
as opposed to:
i = result[i];
Isn't 'i' the variable and 'result[i]' the value?