object javascript code example

Example 1: js object

let car = {
  		name: "BMW",
  		colour: "black",
  		year: "2020",
  		owner: {
		names = ["Andy" , "Steve" , "Tony" ]
		}
};

Example 2: how to create a object in javascript

var a = {
name: "aakash",
  age:30
}

Example 3: js objects

//initialized object
var object = {
  property1: "a", 
  property2: "b",
}

//object initializer function
function object(property1, property2)
{
	this.property1 = property1;
  	this.property2 = property2;
}

//initializing using the initializer function
var mouse = new object("ab", "cd");

Tags:

Java Example