DEV Community

Discussion on: What is Hoisting😰😰 in JavaScript

Collapse
 
nektro profile image
Meghan (she/her) • Edited

It moves the declaration for var up but not the value set

var value;
console.log(value);
console.log('hi hoisting');
value = 'hoisting';
console.log(value);
Collapse
 
josegonz321 profile image
Jose Gonzalez

Yup!

Variable declaration and assignment are done separately.