Skip to the content ForoHackers
Log inJoin

JavaScript and TypeScript: start here

JavaScript and TypeScript
#3061 · · Quote · Report

JavaScript is the language of the web: it runs in every browser and, with a runtime, on servers and tools. TypeScript is JavaScript with a static type system that compiles away to plain JavaScript. Together they are the usual way to build interactive pages and a large share of web back ends, so the quirks of the base language are worth learning properly.

Key concepts

  • Functions and closures: first-class functions are the core of the language, and closures capture variables.
  • Objects and prototypes: objects are bags of properties linked by a prototype chain; classes are syntax over it.
  • Event loop: one thread runs callbacks from a queue; nothing blocks if you do not make it.
  • Asynchronous code: promises and async functions describe work that finishes later.
  • Modules: files that export and import values, the basis of every project.
  • Types in TypeScript: structural types, unions, generics and inference that check code before it runs.

Vocabulary

  • DOM: the document object model, the tree of a page that scripts read and change.
  • Coercion: the language's automatic conversion between types, a source of surprises.
  • Transpiler and bundler: tools that convert and combine source into what the browser runs.
  • Runtime: an environment that runs JavaScript outside a browser.

What to study, in order

  1. Variables, functions, arrays, objects and control flow in the browser's console.
  2. Closures, this, prototypes and the surprising rules of equality and coercion.
  3. The DOM and events: build a small interactive page with no framework.
  4. Promises, async functions and fetching data from a service.
  5. Modules and a package manager, then add TypeScript to the project.
  6. Learn the event loop well enough to predict the order of output of a mixed example.

Related tags

#frontend #web-frameworks #browsers #backend

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply