const myName = 'Andrew';
// Global variable
function introduceMyself() {
const you = 'student';
// Variable declared where introduce() is defined
// (i.e., within introduce()'s parent function, introduceMyself())
function introduce() {
console.log(`Hello, ${you}, I'm ${myName}!`);
}
return introduce();
}
// the introduceMyself() function contains a nested introduce() function. While introduce() does not take in any arguments, nor are there any local variables declared within it -- variables in both the aforementioned settings are indeed in introduce()'s scope.
// introduce() does use the global variable myName, however, as well as the you variable contained in its parent function, introduceMyself() (where introduce() was defined).