Arrow Functions in (IE) Internet Explorer 11


I have AngularJS (1.5.5) and doing testing, the arrow functions do not work in Internet Explorer 11, I have the following code:

return availability.price && availability.options.filter(x => x.leadTime >= 0).length > 0;

And also in this other block generates error:

.then(result => { console.log(result); })
.finally(() => { $window.location.reload();});

What do I do, I start crying?

asked by fredyfx 27.07.2018 в 02:03

1 answer


Calm down, take a deep breath, let's go by parties brother, first things first, the arrow functions were created to save equivalent code (so to speak).

return availability.price && availability.options.filter(function(x){ x.leadTime >= 0}).length > 0;

With regard to the second, this will work for you:

.then(function (result) { console.log(result); })
.finally(function () {


If you find a function like arrow (arrow) and want to send it to be compatible with IE 11, simply add the magic word function followed by the name of the variable as a parameter and in the case that it does not have as in the line of .finally , just add function() . Of course, remember to delete the arrow => and have the start keys { and close } well placed.

If you want a better way to program using JavaScript and that your code is adapted to lower version browsers, I recommend using link

answered by 27.07.2018 / 02:03