In PHP, I’d do something like:
$array = array();
$array[] = "value1";
$array[] = "value2";
$array[] = "value3";
How would I do the same thing in JavaScript?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t need jQuery for that. Use regular javascript
Note: In javascript, you can also use Objects as Arrays, but still have access to the Array prototypes. This makes the object behave like an array:
will create an object that looks like:
You can access the vaules just like a normal array f.ex
obj[0].