JSFiddle - React, Tailwind, and code Playground
JavaScript
//this and IIFE
var person = (function() {
var firstName = "Ryan";
var lastName = "Anklam";
getFirstName = function() {
return firstName + ' ' + lastName;
};
sayHello = function() {
return this.getFirstName() + ' says hello.';
};
return {
'getFirstName' : getFirstName,
'sayHello' : sayHello
};
})();
console.log(person.getFirstName());
console.log(person.sayHello());