JSFiddle - React, Tailwind, and code Playground
by Elijah Manor
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
JavaScript
//Self-Executing Anonymous Function: Part 1 (All Private)
(function() {
//private variable
var ingredient = "Bacon Strips";
//private function
function fry() {
console.log( "Frying " + ingredient );
}
fry();
}());
//Variables not accessible
console.log( window.ingredient ); //Undefined
//Functions not accessible
try {
window.fry(); //Throws Exception
} catch( e ) {
//Object [object DOMWindow] has no method 'fry'
console.log( e.message );
}
//Can't add additional functionality