Tell us what’s happening:
I don’t understand what the Math.max.apply() syntax is doing
Your code so far
function findLongestWordLength(str) {
var splitArr=[];
splitArr.push(str.split(" "));
for(var i=0; i<splitArr[0].length; i++){
var lengthArr=[];
var myIndex=splitArr[0][i].length;
lengthArr.push(myIndex);
Math.max.apply(0, lengthArr);
}
return Math.max.apply(0, lengthArr);
}
console.log(findLongestWordLength("The in quick brown fox jumped over the lazy dog"));
Your browser information:
User Agent is: Mozilla/5.0 (Linux; U; Android 7.0; TECNO P701 Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/64.0.3282.137 Mobile Safari/537.36 OPR/52.1.2254.54298
.
Challenge: Find the Longest Word in a String
Link to the challenge: