Nearby lessons
35 of 40📦 JavaScript Objects & Const Usage
📌 What are JavaScript Objects?
JavaScript Object is a non-primitive data type used to store collections of key-value pairs. It can hold properties (data) and methods (functions).
JavaScript is object-based — everything is treated as an object.
🔸 Object Creation Methods
1. Object Literal: Directly define key-value pairs using curly braces.
2. Object Instance: Use the
3. Object Constructor Function: Use a function with
2. Object Instance: Use the
new Object() syntax.3. Object Constructor Function: Use a function with
this to assign properties.Example02
🔸 JavaScript Array of Objects
Arrays can hold multiple objects. Each object can contain various properties.
Example03
🔸 const with Arrays
const allows array modification (like push()), but not reassignment.
You can change the contents, but not reassign the variable itself.
Example04
🔸 const with Objects
Like arrays, objects declared with const can have their properties updated.
But reassigning the object is not allowed.
Example05
🧠 Test Your Knowledge
10 QuestionsProgress: 0 / 10