How do I specificy a part of an array in a statement?

let newYearsResolutions = ['Run a marathon', 'Learn a new language', 'Read 52 books'];


let listItem = newyearsresolutions[0];


From the Lesson:

The instructions:

Individual elements of arrays can also be stored to variables.

Create a variable named listItem and set it equal to the first item in your newYearsResolutions array using square bracket notation ([]).

Then use console.log() to print the listItem variable to the console.

I do not know how to move on to the next step.


variable names are case sensitive, so newYearsResolutions is the name of your array, but here:

let listItem = newyearsresolutions[0];

you use newyearsresolutions which is an undefined variable. (case sensitive, important! )


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.