Iterating an array to find the longest string. Each time I\'ve received the error Cannot read property length of undefined
. Console.log
tells me th
The problem is the bounds of your iteration
for (i=0; i<=arrayL; i++) {
Note that you are going to be looking for array[array.length] doing this and that will always be undefined because the 10th item in an array of 10 items is [9], [10] is undefined.
Also, please use var here
for (var i=0; i < arrayL; i++) {