niko45,
<script>
var a=[
{date: "19980105", open: 5.995, high: 6, low: 5.995, close: 5.999},
{date: "19980108", open: 5.993, high: 6, low: 5.993, close: 5.999}
], b = [
{date: "19980105"},
{date: "19980106"},
{date: "19980107"},
{date: "19980108"}
];
function fn(a, b) {
var i = 0;
return b.map(function(c) {
if (a[i].date == c.date) return a[i++];
c.empty = true;
return c
})
};
var c = fn(a,b);
document.write(JSON.stringify(c, null, 4))
</script>