This and Javascript
Quick notes on the this keyword in Javascript. It allows access to data within an object without explicitly passing the data through.
var people = {}; // creating empty object
people.data = ['chris', 'toni']; // adding key data with array of people
// regular function to print each name
function print(arr) {
arr.forEach((person) => {
console.log(person);
});
}
// printing each name using this keyword
people.print = function () {
this.data.forEach((person) => {
console.log(person);
});
};