JS-OBJECT-LITERAL

Java Script Object Literal

Normal object creation in JavaScript:

Output: My Name is Ram Kumar and age is 25

JavaScript Object literal Creations:

A JavaScript object literal is a way to define an object directly in JavaScript code using a simple syntax. It involves specifying key-value pairs within curly braces ({}) to define the properties and values of the object.

(If we assign a variable with key-value pairs, that is called a literal.)

Example:

var person = {
name: "John",
age: 30,
city: "New York"
};