Following code behaves differently depending on whether the native version is loaded, or if the polyfill is required and loaded:
const f = require("core-js-pure/es/array/from");
const a = function () {
throw 42;
};
const b = {};
b[Symbol.iterator] = () => undefined
f.call(a, b) // throw '42' in native, throw 'TypeError' in polyfill
The difference comes from the order of construction and type checking - construct should be done first. spec
try {
f.call(a, b)
} catch (e) {
e === 42 // This should be true
}
Following code behaves differently depending on whether the native version is loaded, or if the polyfill is required and loaded:
The difference comes from the order of construction and type checking -
construct
should be done first. spec