JavaScript Crash Course
Make web pages interactive. Values and variables, functions, arrays and objects, the DOM, events, and loading data with fetch and async/await.
JavaScript is the programming language of the web. It runs in every browser, and with Node.js it runs on servers too. This course covers the core language and how to use it to change a page in response to what people do.
What you will learn
- Values, types and variables, and how comparisons really work
- Functions, including arrow functions and callbacks
- Arrays and objects, and the methods you will use every day
- Finding and changing elements on the page through the DOM
- Responding to clicks, typing and form submissions
- Loading data from an API with
fetchandasync/await
Before you start
You should be comfortable with HTML and the basics of CSS. You can run every example in the browser's console: open the developer tools (F12, or Cmd+Option+J on a Mac) and type into the Console tab.
Lessons
- 01Values and variables5 minNumbers, strings, booleans, null and undefined, let and const, template literals, and why you should always compare with ===.
- 02Functions5 minDeclare and call functions, parameters with defaults, return values, arrow functions, scope and closures, and passing functions as values.
- 03Arrays and objects5 minStore lists and records, loop over them, transform them with map, filter, find and reduce, and copy them safely with spread and destructuring.
- 04The DOM5 minFind elements with querySelector, change their text, attributes and classes, create and remove elements, and render a list from data safely.
- 05Events5 minRespond to clicks, typing and form submissions with addEventListener, use the event object, delegate events to a parent, and build a working theme toggle.
- 06Async JavaScript and fetch5 minWhy some code has to wait, promises, async and await, loading JSON from an API with fetch, handling errors and loading states, and running requests in parallel.