A free, self-paced textbook in 8 chapters. Read a chapter, then drill it with the 100 companion flashcards using spaced repetition.
JavaScript is a high-level, interpreted programming language that runs in every modern browser and is the scripting language of the Web. It was created by Brendan Eich in 1995 whil...
JavaScript offers three keywords for declaring variables: var, which is function-scoped, and let and const, both of which are block-scoped and were introduced in ES6. const declare...
Programs make decisions with if, else if, and else blocks. The condition in an if statement is evaluated for truthiness, and JavaScript will coerce any non-boolean value into a boo...
JavaScript's two main collection types are arrays and objects. Arrays are created with square brackets, for example const arr = [1, 'a', true]; or with the new Array() constructor,...
Scope is the region of code where a variable is accessible. The outermost region is the global scope, available everywhere in a script. Variables declared with var are function-sco...
Even though ES6 introduced the class keyword, JavaScript's object system is built on prototypes. The prototype chain is how JavaScript looks up a property: if it is not found on an...
Long-running operations like network requests must run asynchronously so the browser stays responsive. JavaScript represents these operations with Promises, which are objects that...
JavaScript's classic role is to manipulate the Document Object Model (DOM). You can select a single element with document.getElementById('id') or document.querySelector('.class'),...