Skip to main content

Book Summary 01 You don't Know JS by Kyle Simpson

What is JS?

  • JavaScript is a journey, not a destination: Learning JavaScript is an ongoing process. No matter how much time you spend with the language, you will always find something new to learn and understand a little better.
  • JavaScript is multi-paradigm: JavaScript is a language that allows you to write procedural, object-oriented or functional code. You can make these choices on a line-by-line basis, instead of being forced into an all-or-nothing choice.
  • Backwards and backwards compatibility: JavaScript is backwards compatible, which means that code written in the past will continue to work in the future. However, it is not compatible with future versions, which means that code using new features may not work in older JavaScript engines. (BABEL)
  • The web rules everything about JavaScript: Although JavaScript is used in many environments, the web is the environment that governs JavaScript the most. This means that how JavaScript is implemented for web browsers is the most important reality.
  • JavaScript has many faces: JavaScript can be used in different ways, depending on the programming paradigm you choose. It can be used procedurally, object-oriented or functionally.
  • JavaScript and the web: Many features that resemble JavaScript, such as alert(..) and console.log(..), are not defined by JavaScript itself, but by the environment that runs the JavaScript engine.
  • JavaScript and specifications: The syntax and behavior of JavaScript are defined in the ECMAScript specification.
  • The TC39 technical committee manages the official language specification.

In conclusion, JavaScript is a dynamic and versatile programming language that is constantly evolving. It is backwards compatible, which means that code written in the past will continue to work in the future. However, it is not compatible with future versions, which means that code using new features may not work in older JavaScript engines. Despite its complexity and its many faces, JavaScript remains an essential tool for web development and beyond.

  1. TC39. Anyone, whether a TC39 member or not, is welcome to participate in these public discussions and proposal work processes.
  2. Web Compatibility: JavaScript has backwards compatibility, which means that code that is accepted as valid JavaScript will not become invalid in future versions of the language. This means you can write code in JavaScript with confidence, knowing that your code won't stop working unpredictably due to a browser update.
  3. Transpilation: As JavaScript is not compatible with future versions, developers need to take special measures to bridge this gap. For new incompatible syntaxes, the solution is transpilation. Transpilation is a term coined by the community to describe the use of a tool to convert a program's source code from one form to another (but always as textual source code).

In summary, JavaScript is a dynamic and versatile programming language that is constantly evolving. It is backwards compatible, which means that code written in the past will continue to work in the future. However, it is not compatible with future versions, which means that code using new features may not work in older JavaScript engines. Despite its complexity and its many faces, JavaScript remains an essential tool for web development and beyond.

Key Points

  • Each file is a separate program with important implications for error handling and how files interact with each other.
  • Values ​​in JavaScript can be primitives or objects. Primitives include strings, numbers, booleans, null, undefined, and symbols. Objects are unordered collections of various values.
  • Variables in JavaScript must be declared before being used. There are three keywords for declaring variables: "var", "let" and "const".
  • Functions in JavaScript are values ​​that can be assigned and passed around. They can receive parameters and return values.
  • JavaScript has several mechanisms to allow comparison of values. The "===" operator is often used to check equality, but it does not check structural equality for objects, only identity equality.
  • Coercion in JavaScript means that a value of one type is converted to its respective representation in another type. This can cause confusion when used with comparison operators, particularly the "==" operator which is often criticized for its coercive behavior.

Determining the value type

  • The typeof operator can be used to determine the built-in type of a value, primitive or object.
  • typeof null unfortunately returns "object" instead of "null".
  • Conversion from one type of value to another is called "coercion".

Functions

  • Functions in JavaScript can be thought of as procedures that can be invoked multiple times, receive inputs and return outputs.
  • Functions can be declared using the "function" syntax or defined as an expression assigned to a variable.
  • Functions in JavaScript are object values ​​and therefore can be assigned and passed.
  • Functions can receive parameters and return values ​​using the "return" keyword.
  • Functions can be defined as properties on objects.
  • There are many varied forms for defining functions in JavaScript.