Object is the most used type in ECMAScript, and although instances of object do not have much functionality, they are ideal for storing and transmitting data in an application.
There are two ways to create an instance of an object:
The 1.new operator is followed by the object constructor
var New = "Nicholas"= 29;
2. Literal notation
Object literals are shorthand forms of object definitions to simplify the creation of object procedures that contain a large number of attributes.
var person = { "Nicholas", +};
function DisplayInfo (args) { var output = "" ; if (typeof Args.name = = "string" Span style= "color: #000000;" {Output + = "Name:" + args.name + "\ n" if (typeof args.age = "number" Span style= "color: #000000;" {Output + = "Age:" + args.age + "\ n" "Nicholas" 20} );d Isplayinfo ({name: "Greg"
In this example, the function DisplayInfo () takes a parameter. This parameter may have a property named name or age. Use literal to specify different data when calling a function.
JS reference Type--object type