I have AngularJS (1.5.5) and while testing, the arrow functions don't 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 it generates an error:
.then(result => { console.log(result); })
.finally(() => { $window.location.reload();});
What do I do, start crying?
Calm down, take a deep breath, let's go by parts brother, first things first, the arrow functions were created to save equivalent code (so to speak).
Regarding the second, this will work for you:
Generally:
If you find a function of the type arrow (arrow) and you want to send it to be compatible with IE 11, just add the magic word
function
followed by the name of the variable as a parameter and if you don't have as in the line.finally
, just addfunction()
. Of course, remember to remove the arrow and have the start and close=>
keys well placed.{
}
If you want a better way to program using
JavaScript
and have your code adapted to lower version browsers, I recommend using https://www.typescriptlang.org/