Hoisting

noun

say it: “HOYST-ing” /ˈhɔɪstɪŋ/

JavaScript noting every declaration in a scope before it runs that scope, which is why a function can be called above the line that defines it.

What is Hoisting in JavaScript?

Hoisting — The effect of declarations being registered before execution reaches their source line.

showStatus();

function showStatus() {
    return "Ready";
}

In a sentence

  • “Thanks to hoisting, I could call greetCustomer() on line 1 even though the function is written at the bottom of the file.”

Level: Master · More JavaScript terms at this level

Updated