js function within an object code example
Example: js functions inside of objects
var person = {
name: "Fred",
sayName: function() {
console.log(this.name);
}
};
person.sayName();
var person = {
name: "Fred",
sayName: function() {
console.log(this.name);
}
};
person.sayName();