JSFiddle - React, Tailwind, and code Playground
by shravan
JavaScript
// Lexical this
var bob = {
_name: "Bob",
_friends: ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee'],
printFriends: function() {
var _this = this;
this._friends.forEach(function(f) {
return console.log(_this._name + " knows " + f);
});
}
};
console.log(bob.printFriends());