Using Javascript ternary operator

Code using the ternary operator to compare animals and what they eat.



var eatsPlants =false;
var eatsAnimals = false;

var category = eatsPlants && eatsAnimals ? "omnivore" : (eatsAnimals ? "carnivore" : (eatsPlants  ? "herbivore": "undefined"))

console.log(category);