title: Change properties of every item in an array?
body: <p>I need to set the value of every item in this array, counting up.</p>
  
  <p>So, for example, path[0].value = 1, path[1].value = 2 etc...</p>
  
  <p>EDIT: I'm looking for the most efficient way to do this.</p>
  
  <p>I think a for loop is the best way, but I want to learn other ways. Can it be done with the map() method or forEach()? What about a for... in statement? I'd like to do it with pure JS, but if you can teach me a better way with jQuery, I'd be interested to learn that too.</p>
  
  <p>Thanks in advance.
  <div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function Cell(x,y){
      this.xCoordinate = x;
      this.yCoordinate = y;
      this.value;
  }
  var path = [new Cell(0,0), new Cell(0,1), new Cell(0,2)];</code></pre>
  </div>
  </div>
  </p>