How to create an Object in JavaScript? code example
Example 1: objects in javascript
let object = {
'key1': 'value1',
'key2': 'value2',
'keyn': 'valuen',
};
console.log(object);
Example 2: create object javascript
const object = {
something: "something";
}
Example 3: how to create a object in javascript
var about = {
name:"lanitoman",
age:1023,
isHeProgrammer:true
}
Example 4: js create new object
let bike = { name: 'SuperSport', maker:'Ducati', start: function() { console.log('Starting the engine...'); }};bike.start();
Example 5: objects in javascript
let name = {
name1: 'mark'
}
Example 6: 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) ;