javascript function create object code example

Example 1: create object javascript

const object = {
  something: "something";
}

Example 2: js create object with properties

var mycar = new Car('Eagle', 'Talon TSi', 1993);

Example 3: js create object with properties

function Car(make, model, year) {
  this.make = make;
  this.model = model;
  this.year = year;
}

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) ;