What is the difference between an Object and an associative array?


Previously we created an object with literal notation this way:

var spencer = {
  age: 22,
  country: "United States"

In 'Building an Address Book' first exercise, they create an 'associative array' this way:

var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-777",
    email: "bob.jones@example.com"

What is the difference?


No difference, both are object literals, and objects map strings to values.
I'd use Map though


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.