Skip to content Skip to sidebar Skip to footer

I Get A Syntax Error In Ie But Not In Chrome

So I have this code (a function) that works in Google Chrome/Fire Fox but not in IE. If I comment this certain line, everything runs fine, except that line is crucial. I have this

Solution 1:

Arrow functions (like c => c.split('=')[1]) are a new feature in ES6. Chrome supports them. Internet Explorer does not.

Solution 2:

I believe it's an ECMA script 6 thing with the way you're using the map.

So you can write it like this instead:

cookiearray = allcookies.split(';').map(function (c) {
  return c.split('=')[1];
}); //cookiearray is an array that has all the values as strings.

Solution 3:

The solution I implemented was as follows

  1. goto: https://babeljs.io/repl

  2. Paste in your code and select es2015.

  3. In your new code paste the following, if you are using forEach (which is again not supported in IE) :

    if (window.NodeList && !NodeList.prototype.forEach) { NodeList.prototype.forEach = Array.prototype.forEach; }

  4. Use indexOf instead of includes

Post a Comment for "I Get A Syntax Error In Ie But Not In Chrome"