JS Assignment 4: Control Flow Continued
BrianTran2 (17)

Is anyone doing LambdaSchool JavaScript pretest because I have worked for 40 minutes and I can get question 3 from assignment 4 correct.

You are viewing a single comment. View All
Cwill14 (13)

@ReinierB true , and honestly it can be shortened even more. I wrote it out longer for clarity. you literally could put a ternary operator like so

let lovesPizza;
typeOfPizza === "pepperoni" ? lovesPizza = true :  lovesPizza = false;

the condition before the "?" is your "if" statement condition, the code after the "?" applies if the condition is true, the code after the ":" applies if the condition is false.

There are even shorter ways, but they are complicated