logo

JavaScript

Last Updated: 2023-01-08

JavaScript standard: ECMA-262 (https://github.com/tc39/ecma262); a.k.a. ECMAScript.

New features: https://github.com/tc39/proposals/blob/master/finished-proposals.md

JavaScript Engines

Browser

  • Chrome: V8
  • Firefox: SpiderMonkey (the first JavaScript engine, originally used in Netscape Navigator) written in C++, Rust and JavaScript.
  • Safari: Nitro

Beyond Browser

  • Node.js: uses the Google V8 JavaScript engine to execute code.

Browser Object Model (BOM)

window object is used to interact with the browser. The following object can be used directly or under window, e.g. window.navigator or navigator

  • document: HTML DOM
  • navigator: to get browser information
  • history
  • screen
  • location: url, host, path, protocol (NOT the user location)

JavaScript Ecosystem

Most popular web frameworks

  • React: developed and used by Facebook
    • Next.js: built on top of React.js
  • Angular: developed by Google
  • Vue

Bundler

  • WebPack: for apps. Introduced the JavaScript world to the concept of a convention-over-configuration, all-in-one build-pipeline.
  • Rollup: for libs.
  • Vite: written in Go; the successor to Webpack?
  • Turbopack: written in Rust; developed by Vercel; the sibling of Turborepo. Together, they make up the two cornerstones of Vercel’s systems-oriented efforts to evolve front-end tooling: Turbopack is the bundler and Turborepo is monorepo build tool.

Typecheck

  • TypeScript: can be compiled to JavaScript
    • better tooling: advanced autocompletion, navigation, and refactoring
    • developed by Microsoft
    • SUPERSET OF JAVASCRIPT, javascript code is also valid typescript code
  • Flow: also developed by Facebook, so works fine with React

Other notable libs

  • Babel: the compiler
  • D3 / HighCharts: for data visualization
  • Express.js: the node.js web framework
  • Bootstrap: the CSS framework from Twitter.
  • Lerna: build multiple packages from the same repo.
  • ESLint: lint...

es6 backtick

Template literals can be used multi line and may use "interpolation" to insert the content of variables:

var a = 123,
  str = `---
   a is: ${a}
----`;
console.log(str);

Will output:

---
   a is: 123
---

Integer

JavaScript does not have an integer type. JavaScript is only able to handle 52bit integers.

Modern js cheatsheet

https://github.com/mbeaudru/modern-js-cheatsheet