Find the Longest Word in a String--Right but doesn't pass...why?

I don’t understand why this isn’t right.
Can someone explain this?

function findLongestWordLength(str) {

   let arr = [];
  arr = str.split(' ').map(w => w.length);
  str = Math.max(...arr);

  return str.length;

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.

Link to the challenge:

Think what value you are actually assigning to str here and then fix your return statement.

1 Like

Look at what you have logged to the console.

1 Like

So, str is a number because arr is an array of numbers. You then return str.length, which doesn’t exist because a number doesn’t have a length property

I highly suggest you work in making the variables having meaningful names.
Like don’t use str for a number…