title: JQuery or Javascript: iterate through array with days of the week
body: <p>I am developing an app in Electron: I have 7 &lt; div> elements for each day of the week, and they are given ids of #btn-SUNDAY, #btn-MONDAY, etc. </p>
  
  <p>When any of them are clicked on, these buttons should change the text property of a &lt; p> element, with the id of #day, to whichever day of the week the user clicked on.</p>
  
  <p>My guess was to iterate through an array with all 7 days, and then compare which day was equal to #btn-[i], then change #day's text property to the string at the index.</p>
  
  <p>While I'm able to change the text property, I always get "SATURDAY, and -1" as a result. I am obviously doing something very wrong. I could probably write this code out with if statements for each div, but I wanted to save time. Ironically, I've been at this for a while, and the solution is probably dead easy, and I just don't see it.</p>
  
  <p>Here's my code snippet, which is included in the html page with the &lt; div>s: </p>
  
  <pre><code>var days = [];
  days.push('SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY');
  
  for (i in days){
  
    $("#btn-"+days[i]).mouseup(function() {
  
      $("#day").text(`${days[i]}, and ${days.indexOf(i)}`);
  
    })
  }
  </code></pre>
  
  <p>I'm guessing is I need an if statement somewhere in there, but heaven help my brain, I don't know where.</p>
  
  <p>I might also be using the "for (i in x)" syntax improperly. Still trying to get a feel for Javascript and JQuery.</p>
  
  <p>Any help is appreciated,</p>
  
  <p>-Jon</p>