Array definition

Arrays in JavaScript as in most programming languages, are special variables that can hold more than one value. Even though you can have different variables to store the same values, the goal of arrays is that one can loop through them finding a specific one, specially when you have not 3 but 300 elements.

To declare an array, define the variable type with square brackets

var myArray = [1, 2, 3, 4, 5];
myArray[0]; // returns 1
myArray[1]; // returns 2           
        

Array methods

With array methods is possible not only find elements but add, remove, filter and create copies applying different operations. You will find more information about them in the MDN Array reference and W3Schools Array reference

| |
Instructions


Expected result:
JavaScript Editor
Run

You code is not correct. Remember that you MUST use the array method correctly.

You code is correct. Well done!.