# Build a Proofreading Tool - Build a Proofreading Tool

**URL:** <https://forum.freecodecamp.org/t/build-a-proofreading-tool-build-a-proofreading-tool/789717>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [May 24, 2026, 9:38am UTC](https://forum.freecodecamp.org/t/build-a-proofreading-tool-build-a-proofreading-tool/789717 "2026-05-24T09:38:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![d3911ready](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/d3911ready/32/384057_2.png) [@d3911ready](https://forum.freecodecamp.org/u/d3911ready)\
**Post date:** [May 24, 2026, 9:38am UTC](https://forum.freecodecamp.org/t/build-a-proofreading-tool-build-a-proofreading-tool/789717/1 "2026-05-24T09:38:50Z")

</div>

### Tell us what’s happening:

My analyzeText method is not working not only because I am confused on how to interpret the request but because of my findRepeatedPhrases not exactly working well with analyzeText. Although my findRepeatedPhrases, passes all check within its own checkbox criteria, it is likely causing issues with the analyzeTexts.

### Your code so far

```js
function isPalindrome(word)
{
  let count = 0
  for(let i = 1; i <= word.length; i++){
    if(word[i-1].toLowerCase() === word[word.length-i].toLowerCase())
    {
      count++
      console.log(count)
      if(count == word.length){return true}
      
    }
    else return false
  }
}

function findPalindromeBreaks(words)
{
  let countMissingPals = []
  if(words == "")
  {
    return []
  }
  for(let i = 0; i < words.length; i++)
  {
    if(!isPalindrome(words[i]))
    {
      countMissingPals.push(i)
    }
  }
  return countMissingPals
}

function findRepeatedPhrases(words, phraseLength)
{
  let moreThanOnce = []
  let result = []
  if(phraseLength >= words.length){return []}
  for(let i = 0; i < words.length; i++)
  {
    if(moreThanOnce.includes(words[i]))
    {
      console.log(i + " index of word appearing more than once")
      console.log(moreThanOnce.indexOf(words[i]) + " earlier appearance")
      if(result.length == 0)
      {
        result.push(moreThanOnce.indexOf(words[i]))
        //console.log(moreThanOnce[])
        //console.log(result)
      }
      if(result.length > 0 && words[i] == moreThanOnce[0])
      {
        result.push(i)
        //console.log(result)
      }
    console.log(words[i] + " is repeatedWord")
    }
    moreThanOnce.push(words[i])
    //for(let j = 0; j < moreThanOnce)
  }
  return result
  console.log(moreThanOnce + " array")
}

function analyzeTexts(texts, phraseLength)
{
  if(texts.length == 0)
  {
    return []
  }
  const obj = {
      repeatedPhrases: findRepeatedPhrases(words, phraseLength),
      palindromeBreaks: findPalindromeBreaks(words)
    };
}

```

### Your browser information:

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:150.0) Gecko/20100101 Firefox/150.0`

### Challenge Information:

Build a Proofreading Tool - Build a Proofreading Tool

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-v9/lab-proofreading-tool/build-a-proofreading-tool)**
>
> Learn to Code — For Free

GitHub Link: [freeCodeCamp/curriculum/challenges/english/blocks/lab-proofreading-tool/69dd63d1dcdeccb7b39ba4c3.md at main · freeCodeCamp/freeCodeCamp · GitHub](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/blocks/lab-proofreading-tool/69dd63d1dcdeccb7b39ba4c3.md)

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [May 24, 2026, 3:12pm UTC](https://forum.freecodecamp.org/t/build-a-proofreading-tool-build-a-proofreading-tool/789717/2 "2026-05-24T15:12:43Z")

</div>

Hi @d3911ready,

Test your code by calling your function:

`console.log(analyzeTexts(["the", "cat", "sat", "the", "cat"],2))`

This generates an error in the console:

`ReferenceError: words is not defined`

Also, what does `analyzeTexts` return?

Happy coding!

---

<div class="post-metadata">

**Author:** ![d3911ready](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/d3911ready/32/384057_2.png) [@d3911ready](https://forum.freecodecamp.org/u/d3911ready)\
**Post date:** [May 25, 2026, 3:26am UTC](https://forum.freecodecamp.org/t/build-a-proofreading-tool-build-a-proofreading-tool/789717/3 "2026-05-25T03:26:43Z")

</div>

> [@dhess](#):
>
> console.log(analyzeTexts([“the”, “cat”, “sat”, “the”, “cat”],2))

analyze text needs to return an array of objects with the two properties repeatedPhrases and palindromeBreaks as mentioned. However mine are all empty arrays. It looks like I am missing something to better understand what it is that I am missing. Here is my updated function:

function analyzeTexts(texts, phraseLength)

{

const resultArr = []

if(texts.length == 0)

{

```
return \[\]

```

}

for(let words of texts)

{

```
resultArr.push({repeatedPhrases : findRepeatedPhrases(words,phraseLength),

palindromeBreaks : findPalindromeBreaks(words),

}) 

```

}

return resultArr

}

I am stuck on step 16. 1-15 and 17 are all cleared

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [May 25, 2026, 12:08pm UTC](https://forum.freecodecamp.org/t/build-a-proofreading-tool-build-a-proofreading-tool/789717/4 "2026-05-25T12:08:57Z")

</div>

Please post all of your code so it can be tested, and format it as follows:

There are two ways you can format your code to make it easier to read and test:

1. After you copy/paste your code into the editor, select it by dragging your cursor over it then click the (`</>`) button in the toolbar to automatically wrap your code in backticks. (You can click on the animated demo image below to enlarge it.)

 ![](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

1. Manually add three backticks on a new line above your code and on a new line after your code. Note that a backtick is NOT the same as a single quote('). To find the backtick key on your keyboard, see [this post](https://forum.freecodecamp.org/t/forum-code-formatting/25574).

To see changes to your post as you make them, you can click the (`M+`) button on the toolbar to bring up the rich text editor:

 ![image](https://global.discourse-cdn.com/freecodecamp/original/4X/a/a/1/aa16828d97d1fd4a1aa0f864a850415f01dc9d2b.png)

---

<div class="post-metadata">

**Author:** ![d3911ready](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/d3911ready/32/384057_2.png) [@d3911ready](https://forum.freecodecamp.org/u/d3911ready)\
**Post date:** [May 25, 2026, 8:40pm UTC](https://forum.freecodecamp.org/t/build-a-proofreading-tool-build-a-proofreading-tool/789717/5 "2026-05-25T20:40:13Z")

</div>

```auto
function isPalindrome(word)
{
  let count = 0
  for(let i = 1; i <= word.length; i++){
    if(word[i-1].toLowerCase() === word[word.length-i].toLowerCase())
    {
      count++
      console.log(count)
      if(count == word.length){return true}
      
    }
    else return false
  }
}

function findPalindromeBreaks(words)
{
  let countMissingPals = []
  if(words == "")
  {
    return []
  }
  for(let i = 0; i < words.length; i++)
  {
    if(!isPalindrome(words[i]))
    {
      countMissingPals.push(i)
    }
  }
  return countMissingPals
}

function findRepeatedPhrases(words, phraseLength)
{
  let moreThanOnce = []
  let result = []
  if(phraseLength >= words.length){return []}
  for(let i = 0; i < words.length; i++)
  {
    if(moreThanOnce.includes(words[i]))
    {
      if(result.length == 0)
      {
        result.push(moreThanOnce.indexOf(words[i]))
      }
      if(result.length > 0 && words[i] == moreThanOnce[0])
      {
        result.push(i)
      }
    }
    moreThanOnce.push(words[i])
  }
  return result
}

function analyzeTexts(texts, phraseLength)
{
  const resultArr = []
  if(texts.length == 0)
  {
    return []
  }

  for(let words of texts)
  {
    resultArr.push({repeatedPhrases : findRepeatedPhrases(words,phraseLength),
    palindromeBreaks : findPalindromeBreaks(words),
    }) 
  }
  return resultArr
}

```

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [May 26, 2026, 2:43am UTC](https://forum.freecodecamp.org/t/build-a-proofreading-tool-build-a-proofreading-tool/789717/6 "2026-05-26T02:43:28Z")

</div>

Does this function call return what you expect?

`console.log(analyzeTexts([["racecar", "hello", "level", "hello"]], 1));`

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [June 23, 2026, 2:43am UTC](https://forum.freecodecamp.org/t/build-a-proofreading-tool-build-a-proofreading-tool/789717/7 "2026-06-23T02:43:42Z")

</div>

Closed on June 23, 2026, 2:43am UTC

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