Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  9] [ 6]  / answers: 1 / hits: 23611  / 15 Years ago, fri, july 17, 2009, 12:00:00

In JavaScript, what is the difference between an object and a hash? How do you create one vs the other, and why would you care? Is there a difference between the following code examples?



var kid = {
name: juni,
age: 1
}


And:



var kid = new Object();
kid.name = juni;
kid.age = 1;


And:



var kid = new Object();
kid[name] = juni;
kid[age] = 1;


Can you think of any other code example I should illustrate?



The core question here is what is the difference between an object and a hash?


More From » json

 Answers
39

There just isn't any. All three of those are literally equal.


[#99109] Monday, July 13, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
keyanah

Total Points: 642
Total Questions: 93
Total Answers: 114

Location: Virgin Islands (U.S.)
Member since Tue, Jul 7, 2020
4 Years ago
;