Is it possible to create a javascript array similar to PHP’s method which allows you to define the keys during creation?
$arr = array("foo" => "bar", 12 => true);
Or can this only be done like:
myArray["foo"] = "bar";
myArray[12] = true;
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.
In javascript you can achieve this with objects: