Tell us what’s happening:
My code performs the task prompted, but one of the conditions remains uncomplete [findLongestWordLength("May the force be with you")
should return 5)]. BUT my code actually return that.
Your code so far
let arr1, arr2 = []
let x;
function findLongestWordLength(str) {
arr1 = str.split(' ')
for (let i = 0; i < arr1.length; i++){
arr2.push(arr1[i].length)
}
console.log(arr2)
x = Math.max(...arr2)
return x
}
//console.log(findLongestWordLength(str))--> jumped
findLongestWordLength("May the force be with you")
console.log(x)//return 5
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 OPR/62.0.3331.119
.
Link to the challenge: