JS Assignment 9: Intro to Arrays
gustavoyepez (7)

Hello i need help in this exercise:

function exerciseThree(bandsArray){
// Exercise Three: In this function you will be given an array called 'bandsArray'.
// console log the third band in the array.
// Note: DO NOT create a new array in this challenge.
// Note: Remember that array indecies start at 0.
}

You are viewing a single comment. View All
mwilki7 (545)

@gustavoyepez
I assume they mean each element of an array is a "band"
What you have so far is the correct logic, you just need the correct array index.

They want the third element. To know for sure you have the third element, just count from the first:
(arrays start from 0)
0 - first
1 - second
2 - third

So you want to be using bandArray[2] instead of bandsArray[4] because "2" is the third element, "4" would be the fifth