Essential JavaScript

Going Further

Intro to Objects

We are going to learn how to work with objects, but first want to show you a quick example:

const person = { firstName: 'John', lastName: 'Doe', age: 22, };

Above, we see a variable person that contains an object.

Objects are a way to group related pieces of information into a single place so they are easier to work with.

Until now, we could have three separate variables to represent the object above:

const firstName = 'John'; const lastName = 'Doe'; const age = 22;

Now we can encapsulate those values into an object and store it in a single variable.

Learning Goals

  • I can recognize an object in JavaScript code

  • I can see how objects make it easier to organize and work with values that belong together

Code Editor

Click "Run Code" to execute your JavaScript in a secure sandbox and see the output below.

Console Output

// Console output will appear here...

0 output lines

Intro to Objects | N2JS