niko45,
<script>
const 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)
{
a = a.reduce((a,b) => ({date,...d} = b, a[date] = d, a), {})
return b.map(b => ({date} = b, {...b, ...(a[date] ||{empty: true})}))
}
const c = fn(a,b);
document.write(JSON.stringify(c, null, 4))
</script>