Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Truthy and Falsy js

//Checking truthy and falsy value

function truthyOrFalsy (val) { 
    if(val) {
      return true
    } else {
      return false
    }
}

console.log(truthyOrFalsy(0)) // print false
console.log(truthyOrFalsy(5)) // print true
Source by howtodoinjava.com #
 
PREVIOUS NEXT
Tagged: #Truthy #Falsy #js
ADD COMMENT
Topic
Name
3+1 =