Saltar al contenido ForoHackers

JavaScript and TypeScript: start here

JavaScript y TypeScript
#555 · Ophuscado · · Denunciar

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

Inicia sesión o únete para responder.