Q:

creating js objects

var myDog = {
  name: "gozi",
  legs: 4,
  tails: 1,
  friends: ["Ted", "Fred"]
};
1
let obj = {
// fields
  name:"value",
  num: 123,
//methods
  foo: function(){}
  
}
9
function person(fname, lname, age, eyecolor){
  this.firstname = fname;
  this.lastname = lname;
  this.age = age;
  this.eyecolor = eyecolor;
}

myFather = new person("John", "Doe", 50, "blue");
document.write(myFather.firstname + " is " + myFather.age + " years old.");
2
const object = {
  something: "something";
}
2

var car = {type:"Fiat", model:"500", color:"white"};
 
3
var about = {
  name:"lanitoman",
  age:1023,
  isHeProgrammer:true
}
0
var a = {
name: "aakash",
  age:30
}
0
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) ;
0
const person = {
  name: 'Anthony',
  age: 32,
  city: 'Los Angeles',
  occupation: 'Software Developer',
  skills: ['React','JavaScript','HTML','CSS']
};

//Use Template Literal to also log a message to the console
const message = `Hi, I'm ${person.name}. I live in ${person.city}.`;
console.log(message);
-1

New to Communities?

Join the community