**Tell us what’s happening:
Hi there, I’m trying to solve this puzzle and I think im pretty much on the way. In my console the highest number is shown, so I would expect it to be fine when I return variable “highest”. But I get the following error:
undefined is not an object (evaluating 'array[i].length')
Whats going on here?
**Your code so far
function findLongestWordLength(str) {
let array = str.split(" ");
let arrayCount = [];
let highest = 0;
for (let i = 0; i <= array.length; i++) {
arrayCount.push(array[i].length);
highest = Math.max(...arrayCount);
console.log(highest);
}
return highest;
}
findLongestWordLength("The dsfad dasfdsffadefasdfedf fsd fsfdvcsrs");
Link to the challenge: