Last active
March 15, 2023 12:04
-
-
Save desinas/de35f68bf12ec2e5b935856609d227e1 to your computer and use it in GitHub Desktop.
Ice Cream quiz (3-6) from Udacity Front End Developer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Programming Quiz: Ice Cream (3-6) | |
| * | |
| * Write a single if statement that logs out the message: | |
| * | |
| * "I'd like two scoops of __________ ice cream in a __________ with __________." | |
| * | |
| * ...only if: | |
| * - flavor is "vanilla" or "chocolate" | |
| * - vessel is "cone" or "bowl" | |
| * - toppings is "sprinkles" or "peanuts" | |
| * | |
| * We're only testing the if statement and your boolean operators. | |
| * It's okay if the output string doesn't match exactly. | |
| */ | |
| // change the values of `flavor`, `vessel`, and `toppings` to test your code | |
| var flavor = "strawberry"; | |
| var vessel = "cone"; | |
| var toppings = "cookies"; | |
| // Add your code here | |
| if ((flavor === "vanilla" || flavor === "chocolate") | |
| && (vessel === "cone" || vessel === "bowl") | |
| && (toppings === "sprinkles" || toppings === "peanuts")) { | |
| console.log("I'd like two scoops of " + flavor + " ice cream in a " + vessel + " with " + toppings + "."); | |
| } |
mine working perfectly in javascript console but not in Udemy
var flavor = "chocolate";
var vessel = "cone";
var toppings = "sprinkles";
// Add your code here
if(flavor === "vanilla" || flavor === "chocolate") {
if(flavor === "vanilla" && vessel === "cone" || vessel === "bowl" && toppings === "spirnkles" || toppings === "peanuts"){
console.log( "I'd like two scoops of "+ flavor + " ice cream in a "+ vessel + " with " + toppings +".")
} else if (flavor === "chocolate" && vessel === "cone" || vessel === "bowl" && toppings === "spirnkles" || toppings === "peanuts"){
console.log( "I'd like two scoops of "+ flavor + " ice cream in a "+ vessel + " with " + toppings +".")
} else {
console.log("pick vanilla or chocolate ");
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What Went Well
...
Feedback: Your answer passed all our tests! Awesome job!