JavaScript Objects Explained 2026 #10 | Model Real-World Data

Learn JavaScript objects in this beginner-friendly 2026 tutorial. Understand how to model real-world data using objects, properties, and methods with practical examples.

 

---------------------------------------------------------code is here--------------------------------------------------------------------------------

///By the end of Day 10,

//  the student will:

//Understand what

//  an object is

//Represent real-world

//  entities using objects

//Access and modify

// object properties

//Combine arrays + objects

//  like real applications


 

let person = {

    name: "Khan",

    age: 30,

    city: "New Dehli"

};


 

console.log(person.name);

console.log(person["city"]);

// Modify properties


 

person.age = 50;


 

console.log(person);


 

// real world entities

let product = {

    name: "laptop",

    price :99999,

    instock : true

};

if(product.instock){

    console.log("you can buy " + product.name + " for " +product.price);

}


 

// Array of Objects

let users = [

    {name: "Alice", age: 25},

    {name: "Bob", age: 30},

    {name: "Charlie", age: 35}

];


 

for(let user of users){

    console.log(user.name + " is " + user.age + " years old.");

}


 

for(let i = 0; i<users.length; i++){

    console.log(users[i].name + " is " + users[i].age + " years old.");

}

----------------------------------------------------------end----------------------------------------------------------------------------------------