What is wrong with my loop function

Question:

Why does this loop function not continue to count each item? That is after I add more items to the array. Why are extra items added to the array not counted after running the loop function?
Repl link:

const fruits = ['banana','apple','peach','pear'] 
//console.log(fruits[0])
//console.log(fruits[1])
//console.log(fruits[2])
//console.log(fruits[3]) 

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

What language is this @eugerald05

It is suppose to be a “loop function” as described. Although I found an alternative way to loop.

It works just fine for me, what do you mean it’s not adding extra items?

1 Like

Okay problem resolved.

@BananaPi was asking about which programming language (which is very clearly JavaScript if you ask me)

3 Likes

I see console.log I can’t associate with anything besides javascript because of the memes :smile:

1 Like

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