FrontendDeveloper.in

JavaScript question detail

What is an object initializer

An object initializer is an expression that describes the initialization of an Object. The syntax for this expression is represented as a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}). This is also known as literal notation. It is one of the ways to create an object.

var initObject = { a: "John", b: 50, c: {} };

console.log(initObject.a); // John
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399