Entries with dates, loop through and make graph for each date

I have 700 entries in a multiarray with a date on each.

I have to sort them into the different dates, so the 700 entries, there may only be only 15 unique dates.

The problem is that i do not know if there is 7 or 28 unique dates.

So how do i loop through all the entries and push them into a date specific array and afterwards foreach dates.

I know how to do it in PHP. It would look something like this:

$dates = array();
foreach($entry in $entries){
    $date = $entry['date'];
    $dates[$date] = $emtry;
}
foreach($day in $dates){
    foreach($entry in $day){
         echo $entry['title'];
    }
}

How do you do that in Javascript?

Because it is not possible to put characters as a array key..

Answers


JS version would be something like this:

var dates = [];
for (entry in entries){
    date = entry['date'];
    dates[date] = entry;
}
for (day in dates){
    for (entry in day){
         document.writeln (entry['title']);
    }
}

Need Your Help

Can Netty get a notification of SSLEngine getting a close_notify

ssl netty

I have a situation where my (non netty) client is closing the SSLSocket but not the underlying Socket. This does exactly what would be expected it sends a close_notify to the server, which replies ...

GridView databinding issue

c# xaml data-binding windows-8

I have a trouble with GridView data binding.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.