Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Ternary operator level 4 lesson 8

(x>y)?console.log("x is greater"):console.log("y is greater "); is this correct or not
by

1 Answer

sam5epi0l
You should use semi-colon (;), not colon (:) as shown below:


(x > y)? z = x : z = y;
console.log("Value of z:" + z);

Login / Signup to Answer the Question.