I have an IIFE with a nested function inside. There is a word
variable both inside and outside the nested function. How can I access the word
variable outside the nested function instead of the inside one?
Code:
(function (){
let word = "Hello";
function sayHello(){
let word = "Greetings";
console.log(word + " Everyone!"); // This is using the inside word variable instead of the outside one. How can I specify JS to use the outside one instead?
}
sayHello();
})();