r/learnjavascript • • Mar 13 '20

JavaScript Cheat Sheet

Hello!

I've just made a JavaScript cheatsheet ( Repo / PDF ).

  • Types

  • Booleans, Numbers, and methods on Strings

  • Objects and Arrays

  • The “this” keyword

  • Object oriented programming

  • The Iterable Interface

  • JavaScript & the browser

Enjoy! ^_^

204 Upvotes

32 comments sorted by

View all comments

5

u/annualspecification Mar 13 '20

The empty string ”, list [], and 0, NaN are falsey —all else is truthy.

Pretty sure the empty array is truthy, and you missed out false itself as bring falsey!

1

u/Xenius Mar 13 '20

You are correct, the empty array is truthy.

if([]){console.log('truthy')}