Search code examples
javascriptecmascript-6ecmascript-5

What can I do if nothing is supported on IE?


I have an arrow function that was working perfectly on Chrome/Firefox but I also need it working on IE11, and I don't know what more to do.

Here you can see that the arrow functions aren't supported on IE11, so I tried to change my code from ES6 to ES5 here because I read that doing this could solve the problems (on the link you can also check my code :) for removing the arrow functions.

Object.entries isn't supported either, and I'm still needing it. https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/entries

So I tried to use the polyfill of the link above but it uses Reflect which isn't supported either. https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Reflect

Any ideas? I'm really lost with IE11 dev. PD: The code is still working on Chrome/Firefox.


Solution

  • This is naive implementation of Object.entries.
    It works well for all examples in https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/entries

    Object.entries = Object.entries || function(obj) {
       return Object.keys(obj).map(function(k) {
           return [k, obj[k]];
       });
    };