Skip to content

JavaScript object property

  • by

JavaScript object property is a key-value pair that defines a specific attribute or characteristic of an object. Properties can be thought of as variables that belong to an object, and are used to store and retrieve data related to the object.

Here is an example of an object with three properties:

const person = {
  name: 'John',
  age: 30,
  isStudent: false

The Object properties are defined using a syntax that consists of a property name and its corresponding value, separated by a colon (:). Multiple properties are separated by commas (,).

JavaScript object property example

Simple example code access object properties using either dot notation or bracket notation.

<!DOCTYPE html>
    let person = {
        name: 'John',
        age: 30,
        isStudent: false

    // using dot notation

    // using bracket notation



JavaScript object property

You can also add, delete, and modify object properties using the following code:

// adding a new property
person.gender = 'male';

// deleting a property
delete person.isStudent;

// modifying a property
person.age = 35;

Comment if you have any doubts or suggestions on this Js object topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading