Objects in Java Script
Objects are used to store a collection of key-value pairs in a single variable. In JavaScript, you can create an object using curly braces.
Here's an example of an object that contains information about a person:
css
var person = {
name: "John",
age: 30,
occupation: "Software Developer"
};
You can access individual properties in an object using dot notation:
javascript
console.log(person.name); // prints "John"
No comments:
Post a Comment