Array methods in JavaScript

Working with push, unshift

Given the following array:

[1, 2, 3]

Add the elements 4, 5, 6 to its end.

Given the following array:

[1, 2, 3]

Add the elements 4, 5, 6 to its start.

Working with push shift, pop

Given the following array:

[1, 2, 3]

Display the first element of this array.

Given the following array:

[1, 2, 3]

Display the last element of this array.

Working with slice

Given the following array:

[1, 2, 3, 4, 5]

Make this array into the following:

[1, 2, 3]

Given the following array:

[1, 2, 3, 4, 5]

Using this array, store the following array in a new variable:

[4, 5]

Working with splice

Given the following array:

[1, 2, 3, 4, 5]

Use the splice method to transform the array into the following:

[1, 4, 5]

Given the following array:

[1, 2, 3, 4, 5]

Use the splice method to make it into an array:

[1, 2, 3, 'a', 'b', 'c', 4, 5]

Given the following array:

[1, 2, 3, 4, 5]

Use the splice method to make it into an array:

[1, 'a', 'b', 2, 3, 4, 'c', 5, 'e']

Working with indexOf

Given the following array:

[1, 2, 3, 4, 5]

Find the position of the number 3 in this array.

Working with includes

Given the following array:

[1, 2, 3, 4, 5]

Check if this array contains the number 3.

enru