title: JS indexOf fail to work, and always returns -1
body: <p>I am a novice and don't have much experience. Now try to solve some problems at work with JS, and I have encountered a big trouble. Have tried to read some suggested QA, but failed to a solution. I sincerely ask for help, any help is greatly appreciated.</p>
  <p>html:</p>
  <pre><code> &lt;script&gt;
    document.getElementById(&quot;autoin&quot;).addEventListener(&quot;input&quot;,doSearch);
    function doSearch(){
      var ai = document.getElementById(&quot;autoin&quot;).value;
      google.script.run.withSuccessHandler(udAg).getAgent(ai);
    }
    function udAg(ag){
      document.getElementById(&quot;agent&quot;).value = ag;
      M.updateTextFields();
    }
   &lt;/script&gt;
  </code></pre>
  <p>google script:</p>
  <pre><code> function getAgent(ai){
    var ss = SpreadsheetApp.openByUrl(url);
    var ws = ss.getSheetByName(&quot;Updated&quot;);
    var ctList = ws.getRange('A2:A17').getValues();
    var position = ctList.indexOf(ai);
    return position;
    }
  </code></pre>
  <p>It always return -1, even I replaced variable <code>ai</code> by direct string <code>'ABC'</code>, which is the string in A2.
  Tried to return both <code>ai</code> and <code>ctList[0]</code>, they seemed to be identical, <code>'ABC'</code>.</p>
  <p><code>console.log(ctList)</code> showed <code>[ [ 'ABC' ], [ 'CDE' ],[ 'EFG' ],... ]</code></p>
  <p>I really can't figure out a solution, I really need to trouble everyone to help. Thank you.</p>