I am trying to merge two Javascript objects (as shown below) with nodejs, cheerio and css selectors.
The objects are separate because they're being extracted from two different web pages and I cannot use asynchronous functions within my map function that is creating obj1
.
Help with a solution or thinking through the process would be extremely helpful.
obj1 = [
{ position: 1, data: 'AAA' },
{ position: 2, data: 'BBB' }
]
obj2 = [
{ position: 1, review: 'abc' },
{ position: 2, review: 'def' }
]
output = [
{ position: 1, data: 'AAA', review: 'abc' },
{ position: 2, data: 'BBB', review: 'def' }
]