Find the Longest Word in a String:: HELP

Find the Longest Word in a String:: HELP
0

#1

Tell us what’s happening:

I’m trying to print the word length by using the map function ! but some how the o/p in the black console is not printing I tried in chrome console it showed up for me but here it’s not working and of course this is not the solution yet but I’m just trying to figure out how to print the "wordLength " array

Your code so far

{
  var strLength = str.split(" ");
  
  var wordLength = strLength.map(function(word){
    return word.length;
  });
  
  console.log(wordLength);
  
   //return strLength;
}

findLongestWord("The quick brown fox jumped over the lazy dog");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0.

Link to the challenge:


#2

The small black FCC console is very limited in what it can display. Use your browser’s console (Ctrl+Shft+I in Chrome) to see what is being displayed in the console.

FYI - for the findLongestWord(“The quick brown fox jumped over the lazy dog”) call, you get the following array showing in console:

[ 3, 5, 5, 3, 6, 4, 3, 4, 3 ]