Find the Longest Word in a String/ type error

Find the Longest Word in a String/ type error
0.0 0

#1

Im not understand why its giving me the error

TypeError: Cannot read property ‘length’ of undefined.

function findLongestWord(str) {
var array = str.split;
var word = 0;
for (var i = 0; i < array.length; i++){
if ( word < array[i].length ){
word = array[i].length;
}
}
return word;

}

findLongestWord(“The quick brown fox jumped over the lazy dog”);


#2

you may want to check your use of .split as you aren’t defining a parameter for how to split the string


#3

thanks, i always miss stuff like that.