what is hoisting in javascript?

Hoisting is a variable or function's default behavior before declaring in the code. example getName(); console.log(x); var x = 7; function getName() { console.log("Namaste Javascript"); }

Feb 22, 2025 - 12:16
 0
what is hoisting in javascript?
  • Hoisting is a variable or function's default behavior before declaring in the code. example
getName();
console.log(x);

var x = 7;

function getName() {
    console.log("Namaste Javascript");
}