Skip to content

Instantly share code, notes, and snippets.

Created December 21, 2016 16:49
Show Gist options
  • Save anonymous/801e24b2e0c52bf2aef2be07d681ef68 to your computer and use it in GitHub Desktop.
Save anonymous/801e24b2e0c52bf2aef2be07d681ef68 to your computer and use it in GitHub Desktop.
function declaration and function expression created by xgqfrms - https://repl.it/Euze/7
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/
函数声明完全提升。
这意味着整个函数的主体被移动到顶部。
这允许您在声明之前调用函数:
*/
@xgqfrms-GitHub
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment