JSFiddle - React, Tailwind, and code Playground
by Jon Kittell
HTML
<p id="message" onclick="write"></p>
JavaScript
function write(message) {
document.getElementById('message').innerHTML += message + '<br/>';
}
// closure
var a = "a";
var outer = function() {
var b = "b";
var middle = function() {
var c = "c"
// the function 'inner' can access all variables in the outer scopes
var inner = function() {
write(a + b + c);
}
inner();
};
middle();
};
outer();