Hi I just begin learning JavaScript and had a problem with getting this coding quiz right. Can someone show me what’s the right way to do it? Thanks in advance!
/*
- Programming Quiz - Navigating the Food Chain (3-8)
- Use a series of ternary operator to set the category to one of the following:
-
- “herbivore” if an animal eats plants
-
- “carnivore” if an animal eats animals
-
- “omnivore” if an animal eats plants and animals
-
- undefined if an animal doesn’t eat plants or animals
- Notes
-
- use the variables
eatsPlants
andeatsAnimals
in your ternary expressions
- use the variables
-
-
if
statements aren’t allowed
*/
-
// change the values of eatsPlants
and eatsAnimals
to test your code
var eatsPlants = false;
var eatsAnimals = true;
console.log(category);