Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms-GitHub/0b2aad9035a766388180b49d16d4359b to your computer and use it in GitHub Desktop.
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
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