0% found this document useful (0 votes)
23 views

JavaScript Object Properties

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

JavaScript Object Properties

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

JavaScript Object Properties

An Object is an Unordered Collection of Properties

Properties are the most important part of JavaScript objects.

Properties can be changed, added, deleted, and some are read only.

Accessing JavaScript Properties


The syntax for accessing the property of an object is:

// objectName.property

let age = person.age;

or

//objectName["property"]

let age = person["age"];

or

//objectName[expression]

let age = person[x];


Input:

Output:

JavaScript Object Properties


Access a Property with .
John is 50 years old.

Adding New Properties


You can add new properties to an existing object by simply giving it a value:
Output:

JavaScript Object Properties


Adding a new Property
John is English.

Deleting Properties
The delete keyword deletes a property from an object:
Output:

JavaScript Object Properties


Deleting a Property
John is undefined years old.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy