Creating Objects

Creating Objects

  • Data in an object is organized into key-value pairs

  • A key is like a variable name that points to a location in memory that holds a value

  • keys are strings, but when we have a key that does not have any special characters in it, JavaScript allows us to omit the quotation marks:

        const superHero = {
          'secret identity': 'Peter Parker',
          name: 'Spiderman',
          powers: ['super strength', 'hyper awareness', 'agility', 'genius intellect'],
          age: 17
        }
        
    
  • values can be of any data type