Complete the code to assign the larger number to max using the ternary operator.
let max = [1] b > a ? b : aThe ternary operator returns b if b > a is true, otherwise a. The result is assigned to max using =.
Complete the code to print "Even" if number is even, otherwise "Odd" using the ternary operator.
print(number % 2 == 0 ? [1] : "Odd")
The ternary operator checks if number % 2 == 0. If true, it prints "Even", else "Odd".
Fix the error in the ternary expression to correctly assign the smaller value to min.
let min = [1] y < x ? y : xThe assignment operator = is needed to assign the result of the ternary expression to min.
Fill both blanks to create a ternary expression that assigns "Adult" if age is 18 or more, otherwise "Minor".
let status = age [1] 18 [2] "Adult" : "Minor"
The ternary operator syntax is condition ? trueValue : falseValue. Here, age >= 18 is the condition, so ? comes first, then the true value "Adult", then : and the false value "Minor".
Fill both blanks to create a ternary expression that assigns the absolute value of number to absValue.
let absValue = number [1] 0 [2] number : -number
The ternary operator syntax is condition ? trueValue : falseValue. Here, the condition is number > 0, so ? comes first, then number if true, then : and -number if false.