Forked from anonymous/function declaration and function expression.js
Created
March 23, 2017 11:04
-
-
Save xgqfrms-GitHub/0b2aad9035a766388180b49d16d4359b to your computer and use it in GitHub Desktop.
function declaration and function expression created by xgqfrms - https://repl.it/Euze/7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
showState(); | |
// output: Ready | |
console.log("function declaration"); | |
function showState() { | |
console.log("Ready"); | |
} | |
console.log("function expression"); | |
var showState = function() { | |
console.log("Idle"); | |
}; | |
showState(); | |
/* | |
https://www.sitepoint.com/demystifying-javascript-variable-scope-hoisting/ | |
函数声明完全提升。 | |
这意味着整个函数的主体被移动到顶部。 | |
这允许您在声明之前调用函数: | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment