Complete the code to declare a tuple with an optional second element.
let tuple: [number, string[1]];The question mark ? marks the second element as optional in the tuple.
Complete the code to create a tuple type where the last element is optional and of type boolean.
type MyTuple = [string, number, boolean[1]];The ? after boolean marks the last element as optional in the tuple type.
Fix the error in the tuple type declaration to make the second element optional.
let data: [string, number[1]];Adding ? after number makes the second element optional.
Fill both blanks to declare a tuple with an optional second element of type string and an optional third element of type boolean.
let tuple: [number, string[1], boolean[2]];
Both the second and third elements are optional, so both have ? after their types.
Fill both blanks to create a tuple type with an optional first element of type string, a required second element of type number, and an optional third element of type boolean.
type CustomTuple = [string[1], number, boolean[2]];
The first and third elements are optional, so they have ?. The second element is required, so it has no symbol.