Below, i shows up as "i", not the number I am iterating through. How do I correct this? Thanks!
for (i = 0; i < 10000; i++) {
var postParams = {
i : 'avalueofsorts'
};
}
Below, i shows up as "i", not the number I am iterating through. How do I correct this? Thanks!
for (i = 0; i < 10000; i++) {
var postParams = {
i : 'avalueofsorts'
};
}
for (var i = 0, l = 10000; i < l; ++i) {
var postParams = {};
postParams[i] = 'avalueofsorts'
}
Per Cybernate's comment, you can create the object beforehand and just populate it otherwise you create it each time. You probably want this:
for (var i = 0, l = 10000, postParams = {}; i < l; ++i) {
postParams[i] = 'avalueofsorts'
}