Complete the code to declare an array of numbers using generic syntax.
let numbers: Array<[1]> = [1, 2, 3];
The generic array syntax uses Array<Type>. Here, number specifies the array holds numbers.
Complete the code to declare an array of strings using generic syntax.
const fruits: Array<[1]> = ['apple', 'banana', 'cherry'];
The array holds strings, so the generic type should be string.
Fix the error in the generic array declaration.
let flags: Array[1] = [true, false, true];The correct generic syntax uses angle brackets: Array<boolean>.
Fill both blanks to declare an array of objects with a generic type.
const users: Array<[1]> = [[2]];
The generic type defines the shape of objects in the array. The array contains objects matching that shape.
Fill all three blanks to declare and initialize a generic array of booleans.
let flags: Array<[1]> = [[2], [3]];
The generic type is boolean. The array contains boolean values true and false.
