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


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

console.log(newYearsResolutions);

let listItem = newyearsresolutions[0];

console.log(listItem);

From the Lesson: https://www.codecademy.com/courses/learn-javascript-arrays/lessons/arrays/exercises/property-access?action=lesson_resume&course_redirect=introduction-to-javascript

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.


#2

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! )


#3

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