Complete the code to create an array of numbers.
const numbers: number[] = [1, 2, 3, [1]];
The array should contain numbers only. Using 4 (number) is correct.
Complete the code to access the first element of the array.
const first = fruits[1];Arrays use square brackets to access elements by index.
Fix the error in the code to add an element to the end of the array.
numbers.[1](5);
The push method adds an element to the end of an array in TypeScript.
Fill both blanks to create an array of squares for numbers 1 to 5.
const squares = [[1]].map(x => x [2] x);
The array should list numbers 1 to 5, and the map function squares each number using x * x.
Fill all three blanks to filter even numbers and create a new array.
const evens = numbers.filter(n => n [1] 2 === 0).[2](n => n [3] 1);
Use % to check even numbers, map to transform, and + to add 1.
