ProgrammingJavascript scope and hoisting: Understanding block scopeIntroduction to Scope and Hoisting Every programming language has its own rules regarding the scope of the data being stored during program…