title: Modify the list elements in google apps script
body: <p>I have 2 lists as below:</p>
  <pre><code>list1 = [01-0160306, 01-0160302]
  list2 = [[01-0160299, null, 3496.0, 1.0, null], [01-0160302, null, 18.0, 1.0, null], [01-0160306, null, 18.0, 1.0, null]]
  </code></pre>
  <p>If there are elements in list1, then the corresponding arrays in list2 need to be retrieved and the last element &quot;null&quot; has to be replaced with &quot;Yes&quot;. Results need to be pushed back to list2.</p>
  <p>Hence, the result has to be</p>
  <pre><code>list2 = [[01-0160299, null, 3496.0, 1.0, null], [01-0160302, null, 18.0, 1.0, Yes], [01-0160306, null, 18.0, 1.0, Yes]]
  </code></pre>
  <p>I tried looping over the list1 array and then loop over list2 to get its first element. But not sure how to retrieve those rows, modify
  and push it back to list2.</p>
  <pre><code>if(list1.length &gt; 0){
   for(i=0;i&lt;list1.length;i++){
     for (j=0;j&lt;list2.length;j++){
       if(list2[j][0] == i){ //if there is a match
        //Not sure how to modify and push it back to the list2
       }
    }
  }}
  </code></pre>
  <p>I am learning Google Apps Script, any suggestions/leads would be of great help</p>