Skip to main content

Objects

@serverSerrverlesskiy

Objects are like a closet📦 for storing and transporting other types of data. JavaScript is designed around a simple paradigm. The concept is based on simple objects. An object is a collection of properties, and each property consists of a name (key) and a value associated with that name. The property value can be a function⚙️, which can be called a method of an object, or any other type.

Object

In this article, we'll cover the most basic properties of JavaScript objects, creating and modifying, and enumerating properties.

An object in JavaScript is a simple associative array or, in other words, a "hash". It stores any key: value matches and has several standard methods.

Objects in JavaScript, like objects in real life (a person👨, a bus, a building, etc.) have several named (key🗝️) parameters (age, name, hair color, status) with specific values (15, John, black, 'true') ✅:

let obj = {
age: 15,
name: 'John',
color: 'black',
student: true
}

An object method in JavaScript is simply a function️ that is added to an associative array.

Live Editor
Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^

Payment#

Now you are on a stripped-down version of the site, after subscribing to Patreon, you will get full access to the training course, as well as access to our server's private channels in Discord.

Download our mobile application or get tested in our JavaScript telegram bot, and also subscribe to our news.

Become a Patron!

Sumerian school

Links#

  1. MDN web doc. Developer.mozilla.org - Статья "Типы данных JavaScript и структуры данных"
  2. MDN web doc. Developer.mozilla.org - Статья "Инициализация объектов"
  3. Статья "Object Types"
  4. Статья "Объекты", сайт Learn.javascript.ru
  5. Code for Teens: The Perfect Beginner's Guide to Programming, Volume 1: Javascript - Jeremy Moritz

Contributors ✨#

Thanks goes to these wonderful people (emoji key):


Dmitriy K.

📖

Dmitriy Vasilev

💵

Resoner2005

🐛 🎨 🖋

Navernoss

🖋 🐛 🎨

Become a Patron!