Apart from the obvious solution that Richard provided in his answer, Solution 1, I recommend that you use other modern tools and libraries that take away this pain of "works in Chrome, and not in IE", such as Polyfill.
Polyfill.io[
^]
Supported Browsers on Polyfill.io[
^]
Hardcoding these conditions in your own scripts will only cause troubles in a long run, since you would need to take care of other browsers/platforms/devices, too. Tools like Polyfill are capable of taking this pain away from you. :-)
Oh, and focus on writing ES6 compliant code, as that is less error-prone compared to the older versions of JavaScript.
JavaScript ES6 — write less, do more[
^]
ECMAScript 2015 support in Mozilla - JavaScript | MDN[
^]