Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

ternary operators js

;var eatsPlants = false
;var eatsAnimals = true
;var category = eatsPlants? (eatsAnimals? "omnivore" : "herbivore" ) : (eatsAnimals? "carnivore" : "undefined")

;console.log(category)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ternary #operators #js
ADD COMMENT
Topic
Name
9+4 =