Ask coding questions

← Back to all posts
i get the diner outcome but it says i am still failing
Nevels (0)

You and your friends are on vacation, and the group has to come to a decision about
how to decide where to eat every night, given certain conditions.

If it is raining, or windy, or snowing, you will stay at your house and make dinner, but only
if you have enough vegetables, because Becky is a vegetarian. If there aren't enough vegetables
then you will go to the diner around the corner.

If it is either sunny or overcast, then you will go to a local seafood restaurant. Unless
Susan is with you. Susan hates seafood. Thanks, Susan. We'll just have to eat at a pizza place.

Starting you off with the current conditions today.
const weatherCondition = "windy";
const temperature = "warm";
const weHaveVegetables = false;
const susanIsComing = true;
let whereWeWillEat = ""; // Final value determined by your logic

switch (weatherCondition) {
case "raining":
case "windy": // Fill this in
case "snowing": // Fill this in
if (weatherCondition === "windy","raining","snowing" && weHaveVegetables === true) {

} else {

case "sunny":
case "overcast":
  if(weatherCondition === "sunny","overcast" && susanIsComing === true) {
    console.log("seafood restaurant")
  } else {

console.log("pizza restaurant")

Possible values are:
1. "house"
2. "diner"
3. "seafood restaurant"
4. "pizza restaurant"

DynamicSquid (4532)

hmm... case statements seems like an odd choice. I'd just go with if statements

Nevels (0)

the assignment has us doing case statements

DynamicSquid (4532)

@Nevels try reviewing case statements before you move on, like this doesn't make any sense:

 case "snowing": // it's already snowing, but you're checking to see if it's windy?
    if (weatherCondition === "windy","raining","snowing" && weHaveVegetables === true) {

it's a good start though. just read the instructions very carefully, and don't forget to put breaks