declaring new object javascript code example
Example 1: Build JavaScript Objects
var myDog = {
name: "gozi",
legs: 4,
tails: 1,
friends: ["Ted", "Fred"]
};
Example 2: creating an object javascript
let obj = {
// fields
name:"value",
num: 123,
//methods
foo: function(){}
}
Example 3: objects in javascript
let object = {
'key1': 'value1',
'key2': 'value2',
'keyn': 'valuen',
};
console.log(object);
Example 4: objects in javascript
let name = {
name1: 'mark'
}