Home > Net >  How to assign Object assign and map function together in IE 11
How to assign Object assign and map function together in IE 11

Time:09-23

I have sample code that works fine in Chrome but IE11 has problem because of Object.assign method and => sign.

Here is my code below and I don't know how to design it for IE11:

 let dictionary = Object.assign({}, ...tempGroups[tempKey].map((x) => ({ [x.ID]: x.Value })));

Thanks for helping.

CodePudding user response:

Object.assign is not suppported for IE-11. Try to replicate that using a loop since you are using map anyways.

Also instead of arrow functions you can use normal functions.

let dictionary = {};
tempGroups[tempKey].forEach(
function(x) {
 dictionary[x.ID] =  x.Value; 
});
  • Related