All languages

JavaScript

You're viewing a free preview. Sign in free to read every script.

Why this exists The first JavaScript Basics page covers variables and functions. The bugs that cost real time come from four rules underneath: where a variable is visible (scope), when it exists (hoisting), what a…

JavaScript Basics: Scope, Hoisting, Closures, this and Arrow Functions

The rules behind most "why is this undefined?" and "why does my loop print 3 three times?" bugs: var versus let and const, hoisting and the temporal dead zone, closures as private state, and how this is decided, with real output for every trap.

Sign in free to read this script, along with the rest of the library.

Sign in free