/*
let cat = {
name : ‘Bertie’,
breed : ‘Cymric’,
color : ‘white’,
greeting: function() {
console.log("Hello, said " + this.name + " " + this.breed + “.” );
}
}
let cat2 = {
name : ‘Vico’,
breed : ‘Ja’,
color : ‘black’,
greeting: function() {
console.log("Hello, said " + this.name + " " + this.breed + “.” );
}
}
cat.greeting();
cat2.greeting();
*/
Hallo, i would like to know if my code ist correct, i saw a lot of answers from others that they write like this but i dont understand the difference: "
console.log(Hello, said ${ this.name } the ${ this.breed }.
);
"
My question is if just writing “this.name” is enough because i am already inside the object where i wanna access, and when should i use the other method?.
Thank you