Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Modifying Arrays | Arrays
Introduction to TypeScript
course content

Course Content

Introduction to TypeScript

Introduction to TypeScript

1. TypeScript Fundamentals
2. Conditional Statements
3. Arrays
4. Loops
5. Functions

bookChallenge: 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.

12345678
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
copy

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 4
some-alt