Register to get access to free programming courses with interactive exercises

Introduction JS: Objects

Objects are the most interesting and feature-rich data type in JavaScript. It can be used to store information (a set of heterogeneous data) about an object in the real world, such as a Hexlet user. A Hexlet user may be characterized as having an email, name, password, and other parameters. All of this can be "packed" into one object.

// The syntax will be explained in the next lesson
const user = {
  email: 'inna@example.com',
  name: 'Inna',
  password: 'qwerty',
};

The contents of the package.json file can also be represented as a JavaScript object. Moreover, the name JSON itself stands for JavaScript Object Notation:

// json is the representation of an object as text
const data = {
  name: 'MyProjectName',
  description: "My Projects's Description",
  dependencies: [
    // here we have dependencies
  ],
  // here we have the other properties
};

And finally, as hard as it may be to believe, functions and arrays in JavaScript are also objects.

typeof []; // object
// Functions are a little more complicated
// Checking if the function is an object
Math.random instanceof Object; // true

Objects in JavaScript permeate the whole of development from start to finish. They are ubiquitous and used in real-world applications, often for several purposes at once. They are used both as associative arrays (storing key-value pairs) and as objects in the sense of object-oriented programming, which we will definitely get to know later.

Associative array

Knowing how to work with objects in JavaScript is a skillset basis that enables novice programmers to solve pretty complex problems. In this course, there will be a gradual introduction to objects and their capabilities. We'll cover the syntax, real-world use cases, and operators and look at the concept of destructuring and ways to traverse object properties in a loop.


Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

About Hexlet learning process

For full access to the course you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.bookmate">Bookmate</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.healthsamurai">Healthsamurai</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.dualboot">Dualboot</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.abbyy">Abbyy</span>
Suggested learning programs
profession
Development of front-end components for web applications
10 months
from scratch
Start at any time

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Toto Image

Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.