Last active
January 20, 2024 08:09
-
-
Save desinas/907ac97e97223030721c248879c52e79 to your computer and use it in GitHub Desktop.
Navigating the food chain Quiz from Udacity Front end developer
var category = eatsPlants && eatsAnimals ? "omnivore" : ( eatsAnimals ? "carnivore" : ( eatsPlants ? "herbivore" : undefined ) );
var eatsPlants = false;
var eatsAnimals = false;
var category = eatsPlants && eatsAnimals ? "omnivore" : ( eatsAnimals ? "carnivore" : ( eatsPlants ? "herbivore" : "undefined" ) );
console.log(category);
var eatsPlants = false;
var eatsAnimals = false;
var category = (eatsPlants && eatsAnimals) ? "omnivore": (!eatsPlants && eatsAnimals) ? "carnivore" : (eatsPlants && !eatsAnimals) ? "herbivore" : (!eatsPlants && !eatsAnimals) ? "undefined": undefined
console.log(category);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/*
//Please help me
//In this exercise .. I am a beginner
//
eatsPlantsandeatsAnimalsin your ternary expressionsifstatements aren't allowed ;-)*/
/*
eatsPlants,eatsAnimals*/
// change the values of
eatsPlantsandeatsAnimalsto test your codevar eatsPlants = false;
var eatsAnimals = true;
/*
eatsPlants,eatsAnimals, expected output):*/
var category = /* your code goes here */
console.log(category);