Section Overview
Every article in this section follows the same pattern. It introduces syntax and follows suggestions for use. However, any suggestions given are always given with reasons. For example we discuss the use of let for variables, const for true constants. We then suggest that a value that is never to be reset is a const, while anything else should be a let. Semantically that makes sense, but we'll note that many codebases online will have strong beliefs of always use const instead. Rather than saying that our suggestion is law, we present competing ideas where possible, but do make choices.
Where possible we offer both source listings and also runnable code playgrounds. We encourage readers to try things out, but suggest that you fork things to your own codepen online or bring locally for best results.
It should be noted that we introduce what is commonly called Vanilla JavaScript, and spend little time on Typescript and no time on frameworks. This is a purposeful choice and may differ from other tutorials you may read. It is our strong belief that you should learn the core language first, the web platform APIs second, and then and only then should you learn popular frameworks. This may in some sense delay getting to content you may feel is most useful for gainful employment, but this is a purposeful choice as such content is ever changing and does not provide a foundational approach to web dev learning.
As this section does rely on JavaScript, there is a limit to the progressive enhancement philosophy the site employs. If JavaScript is off the content may be readable, but interactive elements will not work. This is by design and is not a mistake. In short, this section and other interactive sections employ more the graceful degradation principle instead.
Articles
- 01JavaScript - A language you can’t avoid
Introducing JavaScript, explaining the difference between language and host, brief overview of the JS ecosystem including TypeScript, and a short history to explain the evolution of the language.
- 02Including JavaScript in web pages
Covers the four ways to include JavaScript, the execution and error behavior, and how to employ modern techniques like modules improves usage.
- 03Statements, variables and flow
The core syntax of JS including statements, declarations, type basics, expressions, branches, loops, and other core constructs.
- 04Types and coercion
Full coverage of primitive types, weak typing, special cases, and gotchas.
- 05Functions and closures
Standard function declarations, parameters, scope, closures, functions as objects, and arrow functions.
- 06Objects and arrays
Properties and methods, reference types, literals, and the relationship between arrays and objects.
- 07Prototypes and classes
Traditional prototype OOP, properties, methods, the prototype chain and modern
classsyntax. - 08Built-ins
Strings, regular expressions, deeper discussion of JavaScript native objects like Date, Math, Array, and JSON.
- 09Errors and async
The challenges of asynchronous coding, handling exceptions, and debugging.
- 10Programming in practice
Addressing JavaScript in practice particularly in the large, understanding shared global namespace, name and event collisions, and introducing modern practices.
- 11How much JavaScript?
Understand the costs and risks of JavaScript and introducing techniques from feature detection to polyfill for resilient coding.
Applied JavaScript
The core language is only half of the topic, we also need to introduce the core platform APIs in their own articles:
- The DOM and Events: manipulating the HTML and CSS of pages in response to user events.
- Web Components: extending HTML using the web platform's own component model.
- Client-Side Communication: communicating with HTTP using platform APIs like
fetch,XMLHttpRequest(aka Ajax),sendBeacon. - Storage and State: saving data in the browser and its dangers
- Scripts and page load: coverage of how to control script load using classic,
defer,asyncand module scripts approaches. - Understanding the JavaScript engine and the event loop: why one thread runs everything and the danger of JavaScript misuse.
Films
- Zero + Five is 05? (9 min), beside page 04: one form field added to a total,
typeof, converting on purpose, and the steps of==. - Clarifying JavaScript Closures (4 min), beside page 05: a counter whose variable stays after its function returns, click handlers, and the loop that prints three, three, three.
- One Object with Many Names (9 min), beside page 06: why assigning an object gives you a second name for it, comparing and copying objects,
constandObject.freeze, and garbage collection.