Зміст курсу
Introduction to TypeScript
Introduction to TypeScript
Challenge: Modifying Arrays
Task
You are given two arrays. Your task is to remove the first and last elements from each of the arrays and then display the combined array on the screen. Use the methods we learned in this section. If you have difficulty understanding the task, you can use the Hint and Solution buttons to view and analyze the solution.
This way, you'll grasp the information better.
let firstArray: (number | string)[] = [0, 1, 2, 3, 4, 5]; let secondArray: (number | string)[] = ['zero', 'one', 'two', 'three', 'four', 'five'] firstArray.___(); //removing the last element secondArray.___(); //removing the last element firstArray.___(); //removing the first element secondArray.___(); //removing the first element let mixedArray: (___ | ___)[] = firstArray.___(___); //mixing two arrays into one console.log(mixedArray); // printing mixed array
Дякуємо за ваш відгук!