1//Checking truthy and falsy value
2
3function truthyOrFalsy (val) {
4 if(val) {
5 return true
6 } else {
7 return false
8 }
9}
10
11console.log(truthyOrFalsy(0)) // print false
12console.log(truthyOrFalsy(5)) // print true
1// Truthy values:
2
3// All values are truthy, BUT (excluding) the following:
40
5''
6undefined
7null
8NaN