title: Javascript change variable name in a foreach loop
body: <p>I am looking to change a variable name from an object within a foreach loop</p>
  
  <pre><code>var days = ['monday','tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
  
  days.forEach(function(day, index){
  
    // agency.openingHours.monday.opening; // replace monday to day
    // here I want instead of monday to have the day, agency.openingHours.day.opening
  
  
  
  })
  </code></pre>