Here I am, being a little silly by posing a not-so-simple question that has been nagging me for quite some time. Let's dive into the data:
const demo1 = [
{ count: 156, monthCount: 1, year: 2018 },
{ count: 165, monthCount: 2, year: 2018 },
{ count: 103, monthCount: 3, year: 2018 },
{ count: 60, monthCount: 4, year: 2018 }
]
const data2 = [
{ count: 100, monthCount: 1, year: 2019 },
{ count: 55, monthCount: 2, year: 2019 },
{ count: 99, monthCount: 3, year: 2019 },
{ count: 130, monthCount: 4, year: 2019 }
]
My quest is to acquire data3 which equals data2 - data1
, with key attributes. The expected output should look something like this:
[
{count: 56, monthCount: 1 },
{count: 100, monthCount: 2 },
{count: 60, monthCount: 3 },
{count: 70, monthCount: 4 }
]