I have code:
let a = {a: 'a', b: 'b'};
let b = {c: 'c', d: 'd'};
let c = {...a, ...b};
In chrome/firefox/... its display: c = {a: 'a', b: 'b', c: 'c', d: 'd'}, but in microsoft edge it throw error Expected identifier, string or number.
I try to use cdn.polyfill.io and https://babeljs.io/docs/en/babel-polyfill but no luck.
What i can do to run my webpack code in microsoft edge?
It should be available in Edge since 79 without any transcompiler (like Babel) needed (but not IE, don't confuse them).
https://caniuse.com/#feat=mdn-javascript_operators_spread_spread_in_object_literals
That said you could in most situations just use Object.assign() instead if you want -
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
Your code would then be:
let a = {a: 'a', b: 'b'};
let b = {c: 'c', d: 'd'};
let c = Object.assign(a,b)
console.log(c)
Object.assign() is supported since Edge 12:
https://caniuse.com/#feat=mdn-javascript_builtins_object_assign
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With