JSFiddle - React, Tailwind, and code Playground
by ppgab
HTML
<button id="1">
Button
</button>
JavaScript
function outsideScope() {
//This identifier needs to be stored as the inner function needs it
const outer = 'outer';
//But will this be stored also?
const otherOutsideScopeStuff = new Array(10000000).join('*');
return function inside() {
console.log(outer);
}
}
function insideScope() {
return function inside() {
console.log('outer');
}
}
//Saving in a button to force it to stay in memory;
document.getElementById("1").addEventListener('click', outsideScope())
//insideScope();