I want to make a comment that for learners following the JS course, we have not learned the .split method yet so we won’t be able to answer this without looking at the solution.
to contribute to the guide please open a thread in the #contributors subforum, posting your proposed solutions and/or hints, and also if there are already other solutions why you think your solution or explanation should be added.
Please include the link to the challenge and/or the #guide thread, and hide the solution using [details="Solution"] on the line above the solution and [/details] on the line below the solution
If you would like to contribute a solution please follow @ilenia’s advice in the post above.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
function findLongestWordLength(str) {
let strArray = str.split(' ');
let biggestNum = strArray[0];
strArray.forEach(item => {
if(item.length > biggestNum.length){
biggestNum = item
}
});
return biggestNum.length;
}
let biggestStr = findLongestWordLength("The quick brown fox jumped over the lazy dog");
console.log(biggestStr);