WARNING

Are you sure you want to reset the challenge? You'll lose all changes you've made to the code.

Creating Objects

An object is a collection of key-value properties. The key is a string, and the value can be any data type: strings, numbers, arrays, functions, or even other objects.

Here's the simplest way to create an object:

const course = {
  name: "Web Development",
  period: 5,
  students: ["Robert", "Bob", "Rob", "Bobby", "Roberto"],
};

Key points:

  • Use curly braces {} to create an object
  • Use a colon : to separate the key from the value
  • keys are strings but don't require quotation marks
  • key-value paris are separated by commas

Tests

Create an object and store it at a variable named student. The object should have a property name with a string value and an age property with a number value.