Development

JavaScript Masterclass

The language itself: values, functions, arrays, objects, and async work.

★★★★★4.8 · Based on 118 learners64 lessons · 16 hr

JavaScript Masterclass stays with the language. You will work through values, functions, collections, and asynchronous work until you can read a script and predict it. HTML and CSS familiarity is assumed. A framework is not.

Course syllabus

  1. 01. Values, comparison, and scope

    • Types, comparison, and scope

      What a value is, how two values compare, and where a name can be seen.

      15 min
    • A number, a string, and a boolean

      Three kinds of value you will store, pass, and test.

      17 min
    • undefined and null

      A missing binding and an empty value are different, and your checks should say which.

      13 min
    • const when the name should keep its value

      Use let only when you truly reassign the binding.

      16 min
    • Strict equality

      === compares value and type, which is the comparison you want for a branch.

      18 min
    • A block limits where let can be read

      A name declared inside braces is not visible outside them.

      14 min
    • A function keeps its own variables

      Parameters and locals belong to that call, not to the whole file.

      18 min
    • A template string builds one sentence

      Drop values into a string you will show, without concatenating pieces by hand.

      12 min
  2. 02. Functions that close over a value

    • Functions and closures

      A function can take inputs, return a value, and remember variables from where it was made.

      17 min
    • A function you can call by name

      Declare it, then call it with the arguments that job needs.

      15 min
    • Parameters and the value you return

      Inputs come in through the parentheses, and return sends one value back.

      16 min
    • An arrow function for a short calculation

      A compact function for a job that is only an expression.

      13 min
    • Pass a function into another function

      The outer function calls the one you handed it, instead of hard-coding the step.

      15 min
    • A closure that keeps a count

      The inner function still sees the counter after the outer function has returned.

      17 min
    • A default when the caller omits an argument

      The parameter takes a fallback so the body does not read undefined.

      13 min
    • A function that only uses its inputs

      Same arguments, same result, with no hidden change to other data.

      16 min
  3. 03. Arrays and objects in memory

    • Arrays and objects

      An ordered list, and a record of named fields, and how you read each one.

      18 min
    • An array holds values in order

      Index 0 is the first item, and length tells you how many there are.

      14 min
    • map, filter, and find

      Build a new list, keep some items, or stop at the first match.

      18 min
    • An object holds named fields

      One record, with keys you choose, for a single thing such as a product.

      12 min
    • Read a property and assign one

      Dot or brackets to read, and an assignment to change that field.

      17 min
    • An array of objects

      Each item is a record, which is the usual shape of a list on a page.

      15 min
    • Pull fields out with destructuring

      Name the properties you need, in the parameter or on the line that receives the object.

      16 min
    • Copy a record before you change it

      A new object keeps the shared one from changing under another function.

      13 min
  4. 04. Branches, loops, and failures

    • if and else

      One path when the condition is true, and another when it is not.

      15 min
    • A comparison produces true or false

      The condition is a boolean, not a value you hope is truthy.

      17 min
    • else if for a third case

      A second test, after the first condition has already failed.

      13 min
    • for...of walks an array

      Each item in turn, without you managing the index.

      16 min
    • Stop the loop once you have the item

      break when further passes would not change the answer.

      18 min
    • throw when the value cannot be used

      A bad input fails here, with a message, instead of continuing as nonsense.

      14 min
    • try and catch around code that can fail

      Catch at the boundary that can explain the failure, not around every line.

      18 min
    • A function that checks one field

      Empty, wrong type, or out of range, and a clear result either way.

      12 min
  5. 05. Find and change elements

    • The document is a tree of nodes

      Elements contain elements, and the script walks that tree.

      17 min
    • Load the script after the markup

      The nodes exist before the script asks for them.

      15 min
    • querySelector finds one element

      The same kind of selector you would write in CSS, returned as one node.

      16 min
    • textContent sets the words

      You set text, not HTML that came from someone else.

      13 min
    • createElement for a new list item

      Build the node in script, then put the item's text on it.

      15 min
    • Append the node to its parent

      The new item appears because you attached it, not because you rewrote the page.

      17 min
    • classList adds or removes a class

      The stylesheet still owns the look; the script only toggles the class.

      13 min
    • null means the selector matched nothing

      Test for null before you read a property or add a listener.

      16 min
  6. 06. Clicks, submits, and listeners

    • DOM events without a framework

      A click or a submit runs your function, using the browser's own listener.

      18 min
    • addEventListener on the button

      Name the event and pass the function that should run.

      14 min
    • The event object tells you what happened

      Target, type, and the methods you may need, on the argument the browser passes.

      17 min
    • Click the button, not the whole page

      The listener sits on the control that means the action.

      11 min
    • Read the input when the form is submitted

      Take the field's value at that moment, not when the script first loaded.

      16 min
    • preventDefault stops the reload

      If your function handles the submit, tell the browser not to navigate.

      14 min
    • One listener on the parent list

      Clicks on items bubble, so you do not attach a listener to every new row.

      15 min
    • Remove a listener you no longer need

      The same function reference you added is the one you remove.

      12 min
  7. 07. Promises, async, and fetch

    • Promises and fetch

      Ask for data, wait for the result, and handle the failure without freezing the page.

      14 min
    • A promise stands for a later result

      The value is not ready on the next line, so you wait or chain.

      16 min
    • then runs when it settles, catch when it fails

      Success and failure are two paths, and you write both.

      12 min
    • async and await read like steps

      await pauses that function until the promise settles, and the next line sees the value.

      15 min
    • fetch asks a URL for data

      The call returns a promise of the response, not the parsed body.

      18 min
    • response.ok is false when the server refused

      A 404 still resolves the promise, so check the status before you parse.

      13 min
    • response.json turns the body into a value

      Await it, and you get the object or array the server sent.

      17 min
    • Show the failure on the page

      Write the error where the person can see it, not only in the console.

      11 min
  8. 08. A list page with no library

    • A list the page can add to

      One form, one array, and a render that draws the items.

      16 min
    • The markup the script looks for

      A field, a button, and an empty list, with ids the script can find.

      14 min
    • Keep the items in an array

      The array is the source; the list on the page is only the current drawing.

      15 min
    • Draw the list from that array

      Clear the old nodes and append one element per item.

      12 min
    • The form adds one item

      Read the field, push the string, and draw again.

      14 min
    • An empty string is not an item

      Refuse it before you push, and leave the list unchanged.

      16 min
    • Save the array in localStorage

      Write it after a change, and read it back when the page loads.

      12 min
    • No library for this page

      The list works with the language and the DOM you already used.

      15 min

Lecture videos stay with the course. Playback for enrolled students will open once payments are available. Video links are not published on this page.