I have two objects with the exact same keys but different values, here is the example I'm struggling with:
obj1={
"cars": ["nissan","toyota","hyundai"],
"color": ["red","black","white"],
}
obj2={
"cars": ["gmc","ford","chevrolet"],
"color": ["orange","blue","grey"],
}
I tried using both:
Object.assign(obj1,obj2)
and:
let merge1 = {...obj1,...obj2}
but output is always:
{
"cars": [ "gmc", "ford", "chevrolet" ],
"color": [ "orange", "blue", "grey" ]
}
The desired output is:
{
"cars": [ "nissan", "toyota", "hyundai" "gmc", "ford", "chevrolet" ],
"color": [ "red", "black", "white" "orange", "blue", "grey" ]
}