Function Scope vs Variable Scope in JavaScript
What is scope of a variable ? Scope determines where the variable is available within the program and its lifetime In the above code snippet, I have defined two functions. displayGreeting function has a variable declared, message. We have assigned a value…