how to use objects in 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 = {
name:"value",
num: 123,
foo: function(){}
}
Example 3: objects in javascript
var object = {'key':'value','the value can be anything',[1,null,'Dr.Hippo']};
Example 4: create object javascript
let voleur = {
action : () =>console.log ('Coup de dague fatal') ,
crie : ('pour la horde!!!!') ,
coupfatal :()=> console.log ('coup dans le dos')
}
voleur.action() ;
voleur.coupfatal() ;
console.log(voleur.crie) ;