JSFiddle - React, Tailwind, and code Playground
JavaScript
var sad = function () {
// Redefine sad so it becomes a new function that returns an object with a stop method
sad = function () {
return {
stop: function () {
alert('Stopped being sad');
}
}
}
// Return true the first time
return true;
}
if ( sad() === true) {
sad().stop();
}