Build a Proofreading Tool - Build a Proofreading Tool

Tell us what’s happening:

All my tests pass except for test 13. I’ve tried many things but nothing seems to work.

Your code so far

function isPalindrome(word){
  let isPalindrome = true;
  for(let i=0;i<word.length;i++){
    let j = word.length -1-i;
    if (word[i].toLowerCase() !== word[j].toLowerCase()){
      isPalindrome = false;
    }
  }
  return isPalindrome;
}


function findPalindromeBreaks(words){
  const arr = [];
  words.forEach((word,index) =>{
    if (!isPalindrome(word)){
      arr.push(index);
    }
  })
  return arr;
} 



function findRepeatedPhrases(words,phraseLength){
  const arr = [];
  let repeat;
  if(phraseLength < words.length){
    for(let  i = 0; i<words.length; i+=1){
      for(let j= i+phraseLength; j<words.length;j++){
        if(words[i] === words[j]){
          repeat = true;
          let count =1;
          let k=i+1;
          let x=j+1;
          while(count<phraseLength){
            if(words[k]!==words[x]){
              repeat = false;
              break;
            }
            count++;
            k++;
            x++;
          }
          if(repeat){
            let rep = false;
            let repj = false;
            for(const ele of arr){
              if(ele === i){
                rep =true
              }
            }
            for(const ele of arr){
              if(ele === j){
                repj =true
              }
            }
           if(!rep){
              arr.push(i)
            }
            if (!repj){
              arr.push(j)
            }        
          }
        }
      }
    }
  }
  return arr;
}


function analyzeTexts(texts,phraseLength){
  if(texts.length===0){
    return []
  }
  let arr = [];

  for (const text of texts){
    const palindromeBreaks = findPalindromeBreaks(text)
    const repeatedPhrase = findRepeatedPhrases(text,phraseLength) 
    arr.push({
      repeatedPhrases: repeatedPhrase,
      palindromeBreaks: palindromeBreaks
    });
  }
  return arr;
}


Your browser information:

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

Challenge Information:

Build a Proofreading Tool - Build a Proofreading Tool

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-proofreading-tool/69dd63d1dcdeccb7b39ba4c3.md at main · freeCodeCamp/freeCodeCamp · GitHub

test with console.log(findRepeatedPhrases(["a", "a", "a"], 2)), your function is not finding anything