'How to fix this error in IE regarding the from [duplicate]

I'm having this error:

Object doesn't support 'from' property or method

on the following line:

const ids = Array.from(cbs).map(function(cb) {cb.getAttribute("data-item-id")});

How can I fix it?



Solution 1:[1]

Array.from is not implemented in IE11, so you'll need to use a polyfill

Solution 2:[2]

Array from is not supported by IE https://caniuse.com/mdn-javascript_builtins_array_from

https://caniuse.com/ is you best friend in these cases.

Use a following polyfill to make it work. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#polyfill

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Sjaak Wish