JSFiddle - React, Tailwind, and code Playground
by HugeHugh
JavaScript
function innerFun() {
alert('full outer');
}
function outerFun() {
function innerFun() {
alert("innerFun inside outer");
}
function runInner() {
innerFun();
}
return {
runInner: runInner
}
}
// try commenting out the first definition of innerFun, and this will not work
innerFun();
var outer = outerFun();
outer.runInner();
// this will not work, innerFun was not exposed in outerFun's return
outer.innerFun();