How do I get the biggest number here

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function findLongestWordLength(str) {
  let wordsAlone = str.split(" "); 
  for (let i = 0; i < wordsAlone.length; i++) {

console.log(findLongestWordLength("The quick brown fox jumped over the lazy dog"));

Can someone help me (without showing the answer) how do I get the longest word from the string. I already got the numbers, but I don’t know how to output the largest one.

Link to the challenge:

Hi, you can simply declare a variable to store the maximum length of a word. At each iteration you can compare the length of word with current maximum length you have stored and change its value if the word length is greater.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.