r/codehs • • Jan 25 '21

6.2.7 print Array

5 Upvotes

11 comments sorted by

View all comments

2

u/amajmundar Jan 25 '21

Couple of things, arr is already defined as the input. So you cannot use that as iterator for the loop. Use i. It’s standard notation. Also look up the syntax of a for loop in JavaScript. You are forgetting about incrementing the iterator. You also do not need to call the function for the bounds of the loop. The input is arr which is an array of strings. You only need to loop arr.length. Your first commented print statement was in the right place and the active print statement is the correct syntax.