JavaScript · Collections, storage and utilities

Hoisting

Function declarations are hoisted with their body; let and const are hoisted but uninitialised until the declaration runs.

Syntax
declarations move to the top

Example

Try it

More in this group

bind / call / apply Closure console methods crypto.randomUUID() Dynamic import() Generator function Intl.NumberFormat JSON.parse()

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course