how to create object of object in javascript code example
Example 1: object object javascript
person = {
'name':'john smith'
'age':41
};
console.log(person);
console.log(JSON.stringify(person));
Example 2: creating an object javascript
let obj = {
name:"value",
num: 123,
foo: function(){}
}
Example 3: objects in javascript
let car = {
engineNumber: 1234
brand: 'BMW',
break: function (){}
}
Example 4: how to create object js
function person(fname, lname, age, eyecolor){
this.firstname = fname;
this.lastname = lname;
this.age = age;
this.eyecolor = eyecolor;
}
myFather = new person("John", "Doe", 50, "blue");
document.write(myFather.firstname + " is " + myFather.age + " years old.");
Example 5: how to create a object in javascript
var about = {
name:"lanitoman",
age:1023,
isHeProgrammer:true
}