Tell me more ×  I want to create an array by extracting the
dates of some other array and then comma separate the values
into a string.        for (i in array) {       var combined=new
array();       combined = array[i].date;  I am new to javascript
and hard to follow in arrays.Thanks !! Can anyone also recommend
me a good book for javascript?  share|improve this question You
are re-declaring the array in each iteration of the for loop.
Also, try . –  Scott S Jul 27 '12 at 13:44 add comment  3
Answers  up vote 1 down vote accepted  Try this  var
originalArray = [{date:"2012-01-01", username: "first"},
{date:"2012-01-02", username: "second"}];  // First step: Get a
dateArray with only the dates var dateArray = []; for (var i in
originalArray) {  // Or if you prefer to cut a few lines //
dateArray = { return; } );  // Second step: Get it as a comma
separated string var datesString = dateArray.join(",");
console.log(dateArray); // ["2012-01-01","2012-01-02"]
console.log(datesString); // 2012-01-01,2012-01-02  O