Applying a function to each object in a JavaScript array

You could use Array.prototype.map:

var new_array = old_array.map(function(e) { 
  e.data = e.data.split(','); 
  return e;
});

As the comment said, this way changes the old_array. You could also return a new object in the callback function without changing the original array.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)