Course Content
Introduction to JavaScript
Challenge: Operations with Array
Task
- Create an array with the given data
["Heine", 25, "Bob", 16]
namedmyArray
. - Cut the last element
16
. - Insert a new element equal to
21
to the end of the array. - Replace the second element with the value
27
via the indexing. - Print the array data to the console.
The output should be :
Hint
1. Use the
2. Use the index
3. Give the array name to 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