xxxxxxxxxx
let names = {
fname: "Dillion",
lname: "Megida"
}
console.log(names.fname);
console.log(names.hasOwnProperty("mname"));
// Expected Output
// Dillion
// false
xxxxxxxxxx
function createNewPerson(name) {
var obj = {};
obj.name = name;
obj.greeting = function() {
alert('Hi! I\'m ' + this.name + '.');
};
return obj;
}
xxxxxxxxxx
function Car(name, model, price) {
this.n = name;
this.m = model;
this.p = price;
}
// Needed Output
"Car One Name Is MG And Model Is 2022 And Price Is 420000"
"Car Is Running Now"
xxxxxxxxxx
function Car(name, model, price) {
this.n = name;
this.m = model;
this.p = price;
}
// Needed Output
"Car One Name Is MG And Model Is 2022 And Price Is 420000"
"Car Is Running Now"
xxxxxxxxxx
var salva = createNewPerson('Salva');
salva.name;
salva.greeting();
xxxxxxxxxx
function Animals(name, specie) {
this.name = name;
this.specie = specie;
}
Animals.prototype.sing = function(){
return `${this.name} can sing`;
}
Animals.prototype.dance = function() {
return `${this.name} can dance`;
}
let Bingo = new Animals("Bingo", "Hairy");