title: Can you use an existing array in the left side of a deconstruction
body: <p>With Google apps script releasing their V8 engine with ES6 support, I was taking myself through an ES6 course.  On the subject of deconstruction I thought of the following scenario that I use in my current code quite frequently.</p>
  
  <pre><code>function oldStyle() {
    var ss = SpreadsheetApp.getActiveSheet()
    var data = ss.getDataRange().getValues()
    var headers = data.shift() //[id, first_name, last_name, email, gender]
    data.forEach(function (row){
     console.log(row[headers.indexOf('first_name')]+" "+row[headers.indexOf('last_name')]) 
    })
  }
  </code></pre>
  
  <p>Using this allows for the columns to be in any order in the spreadsheet, moved etc and the code will still work (obviously they can't be renamed being the downside).</p>
  
  <p>When going through the training page on array deconstruction I immediately thought I could use my headers variable as the left side of a deconstruction so I could really quickly reference columns with minimal code.</p>
  
  <pre><code>function es6() {
    const ss = SpreadsheetApp.getActiveSheet()
    const data = ss.getDataRange().getValues()
    const headers = data.shift() //[id, first_name, last_name, email, gender]
    data.forEach(function (row){
      // Use the headers variable as the left side of destructuring instead of the working line 20
      // let headers = row or
      // let [headers] = row
      // the idea being it's really quick to merge/reference based on column headings
      let [ ,first_name, last_name] = row //instead of having to type the column position in the array
      console.log(`${first_name} ${last_name}`)
    })
  }
  </code></pre>
  
  <p>Having tested this I understand why the commented code doesn't work.  My question is therefore is there a way to make it work? Or a more efficient way of doing what I do with <code>row[headers.indexOf('first_name')]</code></p>