Object literals provide another way to create new objects. Object literals allow object description literals to be embedded in JavaScript code, just as text data can be embedded in JavaScript code as quoted strings. An object literal consists of a list of property specifications enclosed in curly braces, separated by commas. Each property specification list in an object literal consists of a property name followed by a colon and the property value. The general format for creating objects using object literals is as follows:
var myobject = {attribute name 1: attribute value 1, attribute 2: attribute value,..., attribute name n: attribute value n}
From this definition As can be seen from the figure, this definition method actually declares a type of variable and assigns a value at the same time. Therefore, the declared object literal can be used directly in the code without having to use the new keyword to create the object.