Internet Explorer(IE) 11 and Java scripts errors
This would be a quick one-stop-place for referencing all javascript issues which are specific to IE 11 and fixes for it. I will keep on updating once this space as when required.
Issue 1 – Syntax error in the console when using Arrow functions.
When you are using array function (=>) in you javascript code, this will be work in all modern browser but it does not work on IE. IE11 does not support arrow function hence it gives syntax error.
For e.g.
When you click on js file it will take you to line where you have used Arrow function in IE 11
Fix – Use the simple function like below
result= data.d.results.filter(function(p){return mystring.includes(p.strtofind)});
Issue 2 = Javascript Functions and default parameters, not working in IE
Suppose you have a function like below, where you wanted to initialize ‘andClose’ to false if it is not passed from calling functions
function saveItem(andClose = false) { }
You will get below error in Internet Explorer(IE)
SCRIPT1006: Expected ‘)’
Fix – Replace your function with below
function saveItem(andClose) { var andClose = andClose || false; }
Hope this helps…Happy coding.!!!