Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Sunday, February 12, 2012
Generate jquery array so I can use ++arrayname[i]; [closed]
I want to generate a basic array and declare it with a 'n' number of elements in jquery. I want to initialize each value of the array with 0 and I want to be able to call increment each value of the array. How can I do it?
If I understand, you need something like that:
ReplyDeleteTo initialize:
$.each(arrayname, function(idx, elt) {
arrayname[idx]=0; // **EDIT**
});
To increment:
$.each(arrayname, function(idx, elt) {
arrayname[idx]++; // **EDIT**
});