Answers for "Use the Conditional (Ternary) Operator"

4

The conditional (ternary) operator with three condition

String year = credits < 30 ? "freshman" : credits <= 59 ? "sophomore" : credits <= 89 ? "junior" : "senior";
Posted by: Guest on March-26-2020
0

Use the Conditional (Ternary) Operator

function checkEqual(a, b)
{
return a === b ? “Equal” : “Not Equal” ;
}
checkEqual(1, 2);
Posted by: Guest on February-09-2022

Browse Popular Code Answers by Language