The code is not passing the challenge

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

  **Your code so far**

function findLongestWordLength(str) {

let words = str.split('');
let maxLength = 0;
for(let i = 0; i < words.length; i++) {
  if(words[i].length > maxLength){
    maxLength = words[i].length;
return maxLength;

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/100.0.4896.75 Safari/537.36

Challenge: Find the Longest Word in a String

Link to the challenge:

This part here is what is wrong:

let words = str.split(‘’);

This '' is different from ' '.

1 Like

Thank you so much… I got it now

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