Function & Arrays Exercise #37

I did the following code to print the list within the array, however, it didn’t work, anyone have any ideas,

const courses = [“Blockchain & Bitcoin 101”, “Ethereum 101”, “JavaScript for Blockchain Developers”, “12-Week Bootcamp”, “Bitcoin Programming 101”];
for (i = 0; i < courses.length; i++){

Although, now when I look at the answer sheet, it looks a lot less complicated,

I am not sure what the in does


Your code looks good, but when testing it in the console I noticed that the quotation marks showed

“ ”

instead of " ". This could be an issue due to formatting, as you did not use preformatted text. Posting your error message would help to identify the issue.

Try this in the console:

const courses = ["Blockchain & Bitcoin 101", "Ethereum 101", "JavaScript for Blockchain Developers", "12-Week Bootcamp", "Bitcoin Programming 101"];

for (let i = 0; i < courses.length; i++){
console.log(courses[i]); }

Also, for best practice I guess, define i by using let inside the for loop declaration, unless you declared it on a higher scope.



Thanks, yes,

I was really scratching my head even after reading your point. I then copied both codes into a text editor, then noticed your observation about the different quotation marks

1 Like