Skip to content
Playback Speed:


By now, your Auto Editor finds overused words and phrases in a document and highlights them in different colors.

But, it does have a bug.

A bug is an error, or an unexpected behavior in your program.

When the program searches for the word “so,” it also finds words that contain the word “so,” like “some,” “someone,” and “something.”

A computer program does exactly what you instruct it to do, with one hundred percent accuracy, every single time it runs.

This makes a computer perfect for automating repetitive tasks.

It also means that your instructions, or code, must be precise.

In this case, the computer searches exactly for the letters "s” and “o" together.

This means the program finds the word “so,” which is the expected result.

But it also highlights other words that contain these two letters.

Programmers encounter bugs like this all the time.

When you are writing a program for the first time, it is impossible to think of everything.

Testing your program frequently helps you uncover bugs as you work, so you can fix them.

To fix this bug, change the "words" array so that it gives more exact directions.

Insert a space before the s and another space after the o.

This changes the program so it only highlights "so" when it is an individual word, rather than part of a longer word.

Try it out.

Before the change, any word containing the letters “s” and “o” together was highlighted.

Now, only the whole word "so" is highlighted.

This solution is simple, but it is not perfect.

The code does not catch the word “so” at the beginning of a sentence because it looks for the word with spaces around it.

Since the aim of this program is to highlight words for a human to fix, this works fine.

However, if the code automatically replaced words it found, the solution would need to be more precise.

Refine how this code searches for words by adding different forms of words to the search list.

Add a word with and without capitalization, for example, or with and without spaces around it.

It is up to you to decide how to solve problems in the programs you create.

Complicated solutions are often more effective, but they take up more time to code.

Simpler solutions are faster to code, but are not as precise.

Take a look at your list of words.

Refine the values, or add more words if you’d like.

To reuse the code, you can copy and paste all of this code into the script editor of another document.

Or, you can replace the text in this document.

Go to Google Drive and find another document you wrote.

Copy all the text from that document and paste it into this one.

Then, run your code.

Did it find any overused words?

Or, paste in an article from the internet and see what your code finds.

Show a neighbor the results!

Now it's your turn.

Experiment with your “words” array, such as adding spaces or capital letters, to make your code highlight more or fewer cases.

Then, copy and paste a few different articles into your document to see what your program finds.

And finally, share an example with your neighbor.


  1. Change some terms in your “words” array to include spaces or other variations.
  2. Paste text from your own writing or the Internet, and run your code.
  3. Share an example with your neighbor.