top of page

Js Understanding The Weird Parts -

This works because of . During the "Creation Phase" of the execution context, the engine sets aside memory space for variables and functions. Functions are stored in their entirety. Variables (declared with var ) are set to undefined .

This is the weird part of JavaScript that trips up beginners. js understanding the weird parts

console.log(1); setTimeout(() => console.log(2), 0); console.log(3); // 1, 3, 2 This works because of

const p = new Person("Alice");

bottom of page