js create an object code example
Example 1: creating an object javascript
let obj = {
// fields
name:"value",
num: 123,
//methods
foo: function(){}
}
Example 2: how to create a object in javascript
var a = {
name: "aakash",
age:30
}
let obj = {
// fields
name:"value",
num: 123,
//methods
foo: function(){}
}
var a = {
name: "aakash",
age:30
}