title: Verify if cell exists in array of cells
body: <p>I'm trying to iterate through a spreadsheet column while skipping the duplicated values. To do so, I use TextFinder to get all the cells with identical values and I add them to a &quot;duplicates&quot; array.</p>
  <p>At every iteration, an <em>if</em> clause verifies if the current cell is part of the &quot;duplicates&quot; array and if so, it should just skip to the next iteration. However, it isn't the case; it proceeds through my <em>if</em> clause. I tried both &quot;includes()&quot; and &quot;indexOf()&quot;.</p>
  <p>Here's my code:</p>
  <pre><code>let duplicates = [];
      for (let row = 1; row &lt;= range.getNumRows(); row++) {
        const cell = range.getCell(row, 1);
        const value = cell.getValue();
  
        if (duplicates.includes(cell) == false) {
          let array = range.createTextFinder(value).findAll();
          const cellIndex = array.indexOf(cell);
          array.splice(cellIndex, 1);
          duplicates.push(...array);
        }
      }
  </code></pre>
  <p>I'm honestly not sure why it doesn't work. However, I'm new to coding and it's probably a beginner's mistake.</p>
  <p>Any help is appreciated!
  Thanks!</p>