0
Why the answer is "b"?
a(); function a(){ console.log("b"); }
2 Answers
+ 10
This behavior is due to something called "hoisting". JavaScript moves ("hoists") all declarations to the top of the file before executing the code. This applies to function definitions and variable declarations.
For further info, see https://www.w3schools.com/js/js_hoisting.asp
+ 5
because JavaScript is less concerned in the other of which your functions are called so when the function is called it consoles "b"