3. Property Access


#1

var bucketList = ['learn to juggle', 'take a falconry class', 'climb Mt Everest'];

var listItem = bucketList[0];
listItem = bucketList[2];

console.log(listItem[2]);

Error:

 Did you set listItem to the first item in your bucketList array, using [3]?

#2

Edit: I found that didn't work, here's what it wants:

var bucketList = ['learn to juggle', 'take a falconry class', 'climb Mt Everest'];
var listItem = bucketList[3];

console.log(listItem);

List item is just a variable, not an array.


#3

The instructions don't make much sense unfortunately, and you also have to do the things step by step.


#4

I still can't understand what instruction wants. I stuck here:

3. Try to log the item at position [3] to the console.

And i forgot to post a link:


#5

I know it says this, which is really weird, but that means that they want you to change the value of listItem to bucketList[3] because that's the item at [3].
Does this make any sense? I'm not the best at explaining.


#6

Thank you for you help, @kyleaw! With your help I understood what I need to do. Now I passed this lesson and can move on. Finally...
I thought that

Try to log the item at position [3] to the console.

means smth like it:

console.log(listItem[3]);

but in fact I just needed to log the new variable listItem.


#7

Yeah, those lesson instructions really weren't the best.
Glad you passed the lesson, and I enjoyed helping. :slight_smile:


#8

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