whenever I did my switch statement I tried to set each case equal to a string but it did not work. I had to create a console.log for each statement. Does anyone know why that is?
Please post the code you are having trouble with so others can review and comment.
I redid it a second time and it worked!
let userName = âScottâ;
userName ? console.log(Hello ${userName}
) : console.log(âHello!â);
let userQuestion = âAre puppies cute?â;
console.log(${userName} has asked ${userQuestion}
);
let randomNumber = Math.floor(Math.random() * 8);
console.log(randomNumber);
let eightBall = ââ;
switch(randomNumber) {
case 0:
eightBall = âIt is certainâ;
break;
case 1:
eightBall = âYes they areâ;
break;
case 2:
eightBall = âMost of the timeâ;
break;
case 3:
eightBall = âSometimes notâ;
break;
case 4:
eightBall = âYes, especially the big puppiesâ;
break;
case 5:
eightBall = âNot when the poop on the floorâ;
break;
case 6:
eightBall = âThey are adorableâ;
break;
case 7:
eightBall = âMost definatelyâ;
break;
}
console.log(The Magic 8 Ball says, ${eightBall}.
)