Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. const falseyValues = [false, '', 0, null, undefined]
  2.  
  3. const truthyValues = [{}, [], 1, ' ', 'hello']
  4.  
  5. const printItems = val => val ? console.log(`${val} is a truthy value`) : console.log(`${val} is a falsey value`)
  6.  
  7. console.log('------')
  8. falseyValues.forEach(printItems)
  9.  
  10. console.log('------')
  11. truthyValues.forEach(printItems)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement