Nicely written introduction to OOP. I noticed you made a mistake in an example, the method is outside the object.
let user = {
firstName: "Jane",
lastName: "Doe",
getFunction : function(){
return (`The name of the person is
${person.firstName} ${person.lastName}`)
}
console.log(user.getFunction());
Nicely written introduction to OOP. I noticed you made a mistake in an example, the method is outside the object.
let user = { firstName: "Jane", lastName: "Doe", //method getFunction : function(){ return (`The name of the person is ${person.firstName} ${person.lastName}`) } console.log(user.getFunction());// The name of the person is Jane Doe