- The global
a
is set to1
b()
is calledfunction a() {}
is hoisted and creates a local variablea
that masks the globala
- The local
a
is set to10
(overwriting the functiona
) - The global
a
(still1
) is alerted
More Related Contents:
- Javascript function scoping and hoisting
- Are variables declared with let or const hoisted?
- Why variable hoisting after return works on some browsers, and some not?
- ‘Hoisted’ JavaScript Variables
- Order of hoisting in JavaScript
- Why does JavaScript hoist variables?
- Will const and let make the IIFE pattern unnecessary?
- Why a variable defined global is undefined? [duplicate]
- Why do catch clauses have their own lexical environment?
- Are ES6 module imports hoisted?
- How JS hoisting works within functions?
- What happens when JavaScript variable name and function name is the same?
- Javascript – Precedence in hoisting
- How does this hoisting work with block scope? [duplicate]
- Why is my JavaScript hoisted local variable returning undefined but the hoisted global variable is returning blank? [duplicate]
- Is there a purpose to hoisting variables?
- setState doesn’t update the state immediately
- How to convert decimal to hexadecimal in JavaScript
- How to check if a variable is an integer in JavaScript?
- Function in JavaScript that can be called only once
- How to calculate md5 hash of a file using javascript
- How to prevent Unicode characters from rendering as emoji in HTML from JavaScript?
- How to select option in drop down protractorjs e2e tests
- Finding longest string in array
- Adding additional data to select options using jQuery
- jQuery() not finding elements in jQuery.parseHTML() result
- node.js /socket.io/socket.io.js not found
- Maximum item size in IndexedDB
- How can my Add-on SDK content script interact with a website page script?
- Remove value from object without mutation