DEV Community

Tejkumar Kempaiah
Tejkumar Kempaiah

Posted on

๐Ÿ”ฅ Objects in JavaScript

โ˜‘๏ธ What are Objects?

  1. Objects are collection of property and property values
  2. Every object has state and behavior
  3. A real time object is mimicked in the programming world
  4. A object can contain below things in it.

a. variable(integer, decimal, Boolean, character, string)
b. array
c. function
d. another object

โ˜‘๏ธ How to create objects in JavaScript?

image

Output:

image

โ˜‘๏ธ How to make an object read only?

image

Output:

image

โ˜‘๏ธ How to make an object extensible(un expandable) but modifiable

image

Output:

image

โ˜‘๏ธ How to expand an object property ?

image

Output:

image

โ˜‘๏ธ How to add an Boolean object property to an Object?

image

Output:

image

โ˜‘๏ธ Object DE structuring

image

Output:

image

Discussion (0)