Note: You Don't Know JS
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
avariable holds every different type of value, and that despite appearances,typeof ais not asking for the “type ofa”, but rather for the “type of the value currently ina.” 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(invalidnumber)null,undefinedfalseAny value that’s not on this “falsy” list is “truthy.”
Comments
Leave a comment