Alternative to array.includes() in google apps script? : <p>I'm using <code>range.getValues()</code> to load an array in Google Apps Script.</p>

<pre><code>var array = SpreadsheetApp.getActive().getActivesheet().getRange('E10:E30').getValues();
&gt; array = [["val1"],["val2"],["val3"],["val4"]]
</code></pre>

<p>I then want to loop through a separate list to see whether its elements exist in the array, using array.prototype.includes():</p>

<pre><code>if(array.includes("val4")) {doSomething;}
</code></pre>

<p>Using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes" rel="noreferrer">array.prototype.includes()</a> like this does not work for two reasons: <strong>1)</strong> since each element in <code>array</code> is an array in itself and <strong>2)</strong> because the method isn't available in Google Apps Script:</p>

<blockquote>
  <p>TypeError: Cannot find function includes in object</p>
</blockquote>

<p>Then wanted to use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat" rel="noreferrer">array.prototype.flat()</a> to solve <strong>1)</strong> but it seems it <a href="https://stackoverflow.com/questions/39317252/what-functions-do-arrays-in-google-apps-script-support">isn't available in Google Apps Script either</a>.  I get the following error:</p>

<blockquote>
  <p>TypeError: Cannot find function flat in object</p>
</blockquote>

<p>This is something I could do using brute force, but surely there's a neat way of doing it?</p>
