putting functions in objects javascript 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();