DEV Community

Pere Sola
Pere Sola

Posted on • Updated on

[WIP] You Don't Know JavaScript. Glossary.

You Don't Know Javascript by Kyle Simpson is a good series of books to deep dive into the language. There are a lot of words that I hear again and again, this is a repository of definitions that I find useful.

  • Coercion: Converting from one value type to another, such as from string to number, is referred to in JS as "coercion."
  • const: can be re-assigned but not mutated.
  • Function declaration: it appears as a statement by itself, not as an expression in another statement. The association between the identifier and the function value happens during the compile phase of the code, before that code is executed..
  • Function expression: This function is an expression that is assigned to the variable. Different from the function declaration form, a function expression is not associated with its identifier until that statement during runtime..
  • Let vs var: let allows a more limited access to the variable than var. This is called "block scoping" as opposed to regular or function scoping.
  • Literals: in JS programs, values can either appear as literal values (as many of the preceding examples illustrate), or they can be held in variables; think of variables as just containers for values.
  • Primitive values: string, boolean, number, bigint, null, undefined and symbol.
  • Values: most fundamental unit of value. Values are data. They're how the program maintains state. Values come in two forms in JS: primitive and object. Primitives are held by value. Objects are held by reference..
  • var vs let: The let keyword has some differences to var, with the most obvious being that let allows a more limited access to the variable than var. This is called "block scoping" as opposed to regular or function scoping. (...) But var is still useful in that it communicates "this variable will be seen by a wider scope (of the whole function)". Both declaration forms can be appropriate in any given part of a program, depending on the circumstances.

Top comments (0)