Click here to Skip to main content
14,668,708 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have 4 variables in jquery called qual1p, qual2p, qual3p and qual4p.

I want to assign values to them inside a for loop.

something like
for (var i = 0; i < blue.length; i++) {
        qual?p = blue[i][5];
}



how do I code qual?p so that ? is i ?

Thanks
Posted
Updated 4-Nov-15 7:32am
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

There are several suggestions here, http://stackoverflow.com/questions/3834373/how-to-reference-a-variable-dynamically-in-javascript[^].

I believe the object one is the one you'll likely want to use.
   
Comments
Nosfa 6-Nov-15 17:18pm
   
I have to make an array. There's no other way. thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100