So, why does this result in 0 and how do I find the actual size?
var array = [];
array["foo"] = "bar";
array["bar"] = "foo";
document.write(array.length);
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.
Since that is a object, which is comprised of properties, and take the form of key/value pairs (conceptually similar to an associative array, or a hash table) you will have to do something like this:
Demo: http://jsfiddle.net/gBG34/