Tell us what’s happening:
Your code so far
var ourArray = [];
function findLongestWord(str) {
array = str.split(" ");
for(var i=0; i<array.length; i++) {
ourArray.push(array[i].length);
}
ourArray.sort(function(a,b) {
return b-a;
});
return ourArray[0];
}
findLongestWord("May the force be with you");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
.
Link to the challenge: