function parent() {
let name = 'joe';
printName();
function printName() {console.log(name)}
}
this works, but i want to move printName outside of the other function.
function parent() {
let name = 'joe';
printName();
}
function printName() {console.log(name)}
but this does not work, since name is stuck inside the parent function. Is there a way to send the current scope of parent to printName when I call that function on line 3? something like .bind but for all variables not just this