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

Level -4 the last topic ternary operator

I'm not able to finish the coding challenge even through I have done with the correct code step to finish the exercise.

Please find below the code and the error getting when submitting the code

let x = 10;
let y = 1;
let z;
// your code comes here
z=(x > y)?x:y;
console.log("Value of z:",z);



The Error message-Use the ternary operator on line number number 5 with condition (x > y)


Please help me out this
by

1 Answer

iamabhishek
Here is the correct answer:

let x = 10;
let y = 1;
let z;
// your code comes here
(x > y)? z = x : z = y;
console.log("Value of z:" + z);

Login / Signup to Answer the Question.