JSFiddle - React, Tailwind, and code Playground
JavaScript
var person = 'Bob';
(function () {
var room = {
capacity: 10,
exits: 2,
count: 0,
person: '',
addPerson: function (name) {
this.count += 1;
var nestedFunction = _.bind(function (nameOfPerson) {
this.person = nameOfPerson;
},this);
nestedFunction('dave');
}
};
room.addPerson('dave');
console.log(room.person);
}());