course content

Course Content

Introduction to JavaScript

Challenge: Operations with ArrayChallenge: Operations with Array

Task

  1. Create an array with the given data ["Heine", 25, "Bob", 16] named myArray.
  2. Cut the last element 16.
  3. Insert a new element equal to 21 to the end of the array.
  4. Replace the second element with the value 27 via the indexing.
  5. Print the array data to the console.

The output should be :

Hint
1. Use the pop() and push() methods to cut/insert elements.

2. Use the index 1 to work with the second element.

3. Give the array name to the console.log() function to print the array data to the console.

Section 2.

Chapter 8