Mehdi Tmimi JavaScript

Course · Bachelor, software engineering

JavaScript, then Node.js.

How JavaScript really runs, one question at a time. Read a chapter, predict what the code does, run it in two playgrounds, write it once yourself, and explain every line.

The rule of this course

An assistant will type most of your code. Predict it, write it once yourself, test it.

If you cannot explain a line, it is not yours.

Autocomplete stays on in both playgrounds: when it offers a name, ask where that name comes from.

Every chapter has an interview corner: questions you answer out loud, with a claim, how it works, what it changes.

How a chapter works

  1. 1

    Read, about 3 minutes.

    One question, a short answer, five short sections.

  2. 2

    Predict, 1 minute.

    Commit to an answer before you run anything.

  3. 3

    Run, 3 minutes, in the playgrounds.

    The Web Playground for a page, the Node.js Playground for Node: each link opens the code and waits for Run.

  4. 4

    Write it once yourself, 1 minute.

    Change one line, run it again.

  5. 5

    Explain, 2 minutes.

    The interview corner, out loud, then a 5-question check.

10 min Core path: about 10 minutes.

One question each, in the order of the course. Two parts: JavaScript, then Node.js.

  1. Part 1 · JavaScript
  2. Under the hood01available now
  3. 01 · Engines and environments

    How does JavaScript run?

    Your JavaScript runs in Chrome, in Node.js, on your phone. Who actually runs it?

    3-min read · try it 5 min · film coming

  4. The language02 – 0902 available now
  5. 02 · Variables and scope

    How do variables work in JavaScript?

    Every file is full of const, let and var. Which one should you keep, and where can you use it?

    3-min read · try it 10 min · film coming

  6. 03How does JavaScript handle types?

    typeof, == or ===, and why '5' + 1 gives '51'.

  7. 04How do objects and arrays work?

    A variable holds a reference: change the copy, and the original changes too.

  8. 05What is a function in JavaScript?

    Declaration, expression, arrow: three ways to write one, and a function is a value.

  9. 06What is a callback?

    map, filter, forEach, sort: you hand them a function, they call it.

  10. 07How does a function remember its variables?

    A closure: a counter that keeps counting after its function returned.

  11. 08Who decides the value of this?

    The call decides, not the place where the function was written.

  12. 09What does a class really create?

    class, extends, and the prototype where an object’s methods live.

  13. Syntax labas the course advances
  14. lab · no filmLoops, conditions, the syntax you use every day

    Typed cards with tests: destructuring, spread and rest, ?. and ??, JSON.

  15. Asynchrony10 – 13as the course advances
  16. 10Why doesn’t JavaScript wait?

    One thread and the event loop: a zero-millisecond timer still waits its turn.

  17. 11What does a promise promise?

    Its function runs at once, and it settles only once.

  18. 12In what order does JavaScript run what is waiting?

    The queue a promise jumps.

  19. 13What does await pause?

    async and await: the function pauses, the rest of the program keeps running.

  20. Async labavailable now
  21. lab · no film · Asynchrony

    One dashboard, four ways to wait

    A slow server and a student dashboard: the same calls with synchronous XHR, callbacks, promises, then async/await.

    in class · your own data on the lab server

  22. Part 2 · Node.js
  23. The same engine, another environment14 – 20as the course advances
  24. 14What is Node.js made of, and when does a Node program end?

    A script exits by itself; a server never does.

  25. 15What happens when you import a file?

    require and import: the file runs once, and shares only what it exports.

  26. 16What does npm install put in your project?

    Dozens of strangers’ packages, running with your rights.

  27. 17What does Express add to a Node server?

    A server with Node’s http module, then the same one with Express.

  28. 18How can one thread serve thousands of clients?

    A pool of four threads, and one thread that stays free.

  29. 19What freezes a Node server?

    One slow route, and every route waits.

  30. 20How does Node handle a huge file?

    Streams: a gigabyte through a few tens of megabytes.

  31. Lab projectas the course advances
  32. lab · no filmA notes API and a mini-Express

    Built from the functions you wrote in the chapters.

The two playgrounds

On your machine · real Node

For what a browser cannot show, later in the course.

Chapter links open the code and wait for Run, so you can predict first.

The films

One film per chapter on TMIMI Explains, about 3 minutes, English narration with captions. The runs in the films are screenshots of these same two playgrounds: what the film shows, you can run.

First film: coming