Why on earth this is not working?

Why on earth this is not working?
0

#1

Hi, this is my first time posting here, i’m having troubles with ‘Find the Longest Word in a String’ from the Basic Algorithm Scripting challenges, it seems to me that the problem is not my code but rather the “codechecker” as it clearly returns what it is asked for in the challenge, but the page just keeps telling that it is incorrect so i dunno what to do, at first i complicated all out thinking that an object was needed and now that i came to this simple solution it says that it is wrong, i’m quite stressed at this point please help, i tested the code on both runkit and the challenge page and it returns the correct number but the damn page kkeps telling otherwise

//simple function that takes a string and returns the length of it's largest word
function longestWord(str) {
  const separatedStr = str.split(' ');
  let lengths = [];
  const characterCounterAppender = separatedStr.forEach(function(element) {
    lengths.push(element.length);
    return lengths;
    });
  lengths = lengths.sort(function(a, b){return b-a;});
  console.log(lengths);
  return lengths[0];
}
longestWord("The quick brown fox jumped over the lazy dog");type or paste code here

#2

Nevermind, the problem is the name of the function…