What is wrong with this line.
it says uncaught syntax error in the console.
var aqar= new Array(1:'1_2',2:'5_1',3:'3_3');
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.
If you’re really trying to create an array, normally JavaScript arrays are
0-based, not1-based, and that’s now how you initialize them.Here’s a zero-based array
Or you may prefer to use a non-array object:
…but then you won’t have all the great
Arraystuff.If you really want to, you can create a JavaScript array that has no element at position
0like this:That creates a sparse array (an array with holes in it). It has no element
0. (As opposed to having an element0with the valuenull, which is what another answer here does.) But unless you have a very good reason, I wouldn’t.