I try to merge 2 array of objects using Object assign. I know I can do this with map by comparing their ids, but somehow didn't worked in object.assign?
const ageArr = [{
"id": 1,
"age_range": "0 - 10 Years old",
"value": 1
}, {
"id": 2,
"age_range": "11 - 20 Years old",
"value": 1
}, {
"id": 3,
"age_range": "21 - 30 Years old",
"value": 78
}]
const colorArr = [{
"id": 1,
"color": "#333"
}, {
"id": 2,
"color": "#666"
}, {
"id": 3,
"color": "#999"
}]
const mergedArr = Object.assign({}, ageArr, colorArr)
console.log(mergedArr)
Object.assignhas nothing to do with inheritanceObject.create. And no, your fiddle shows thatObject.assignreturns its first argument -Parent === Child.