To see list

  • Up & Going
    • Foreword
    • Preface
    • Chapter 1: Into Programming
    • Chapter 2: Into Javascript
    • Chapter 3: Into YDKJS
  • Scope & Closures
  • this & Object Prototypes
  • Types & Grammer
  • Async & Performance
  • ES6 & Beyond

Up & Going

Chapter 1: Into Javascript

typeof a

Notice how in this snippet the a variable holds every different type of value, and that despite appearances, typeof a is not asking for the “type of a”, but rather for the “type of the value currently in a.” Only values have types in JavaScript; variables are just simple containers for those values.

Truthy & falsy

The specific list of “falsy” values in JavaScript is as follows:

  • "" (empty string)
  • 0, -0, NaN (invalid number)
  • null, undefined
  • false

Any value that’s not on this “falsy” list is “truthy.”