I don’t know why this isn’t working. I thought I’ve seen this in use a dozen times but it appears that I looked at it the wrong way judging from this:
var array = ["dog", "cat"];
console.log(array["dog"]); // undefined, why?
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.
What you have is not an associative array, it does not act as such. A JavaScript object acts as such. The object’s literals are
{}, not[].