If I have something like this:
var cars = [
{car:"01", color:"red", date: Date("Sep 23, 2013 12:00:00")},
{car:"02", color:"blue", date: Date("Sep 24, 2013 12:00:00")},
{car:"03", color:"green", date: Date("Sep 25, 2013 12:00:00")},
{car:"04", color:"yellow", date: Date("Sep 26, 2013 12:00:00")},
{car:"05", color:"purple", date: Date("Sep 27, 2013 12:00:00")}];
and I want to: 1) select an item car:"03"
for example, how do I do this? I thought of doing something like this, just for testing, but this didn't work out:
$(cars).each(function(i,el) {
console.log($(this).car);
});
and 2) is this valid to compare this kind of Date
in the array to real current Date
? for example:
var currentDate = new Date();
if ( currentDate < Date ) { ...
Thanks!