title: Modify object inside array without using loop
body: <p>Is there any way in javascript which can modify array value. I have done it by using <code>for loop</code> and there is another method call <code>forEach</code>. I wanted to get it done by using only one line. Like I have seen code for converting onject into array by using <code>Array.prototype.slice</code>. So can we get the requirement done by using similar function. I google it but did not find any relevant post.</p>
  
  <pre><code>this.gome = (function(data){
          for(var i=0;i&lt;data.length;i++){
            data[i].id = i
          }
          return data })(data.gome);
  
  this.gome = Array.prototype.slice.call(data.gome,//code) // something like that.
  </code></pre>