67
rated 0 times
[
69]
[
2]
/ answers: 1 / hits: 56870
/ 7 Years ago, tue, february 7, 2017, 12:00:00
I have the following array of object:
Objs[0] = {Name : "ABC"};
Objs[1] = {Roll : 123}
I'm trying to make it as the following:
Objs {
Name : "ABC",
Roll : 123
}
I attempted to make it with the following code:
var Objs = [{
Name: "ABC"
}, {
Roll: 123
}];
console.log(
Object.assign.apply(null, [{}].concat(Objs)) // 1
)
or
console.log(
Object.assign({}, ...Objs) // 2
)
The problem is that this is not working in IE 11.
I get the errors:
Error for 1 : Unable to get property 'on' of undefined or null reference
Error for 2 : Object doesn't support property or method 'assign'
Any suggestions on how I should merge the object in IE 11?
More From » object