JSFiddle - React, Tailwind, and code Playground
by rsschouwenaar
JavaScript
var thisGlobalVariable = 'Twitter';
var thisSecondGlobalVar = 3000;
(function() {
// Local scope
var thisVariable = 'Google';
var thisSecondVar = 250;
(function() {
var thisNestedVar = 900;
var secondNestedVar = 'Facebook';
console.log('------------------ Nested Local ------------------');
console.log('Nested Local thisGlobalVariable: ', thisGlobalVariable);
console.log('Nested Local thisSecondGlobalVar: ', thisSecondGlobalVar);
console.log('Nested Local thisVariable: ', thisVariable);
console.log('Nested Local thisSecondVar: ', thisSecondVar);
console.log('Nested Local thisNestedVar: ', thisNestedVar);
console.log('Nested Local secondNestedVar: ', secondNestedVar);
})();
console.log('------------------ Local ------------------');
console.log('Local thisGlobalVariable: ', thisGlobalVariable);
console.log('Local thisSecondGlobalVar: ', thisSecondGlobalVar);
console.log('Local thisVariable: ', thisVariable);
console.log('Local thisSecondVar: ', thisSecondVar);
console.log('Local thisNestedVar: ', thisNestedVar);
console.log('Local secondNestedVar: ', secondNestedVar);
})();
// Global scope
console.log('------------------ Globals ------------------');
console.log('global thisGlobalVariable: ', thisGlobalVariable);
console.log('global thisSecondGlobalVar: ', thisSecondGlobalVar);
console.log('global thisVariable: ', thisVariable);
console.log('global thisSecondVar: ', thisSecondVar);
console.log('global thisNestedVar: ', thisNestedVar);
console.log('global secondNestedVar: ', secondNestedVar);