Expected ')' JS Error in IE after Assigning a Value to a Function Argument

I wrote the code below in my JS file, and IE gives an error for the searchMap argument when I assign a value to it in a function.

mapping: function (mappingObj,searchMap=false) { // code } 

Error: Expected ')'

+5
source share
2 answers

You are using the default parameter. This is a feature of ES6 and is not yet supported by IE .

I would suggest converting your code to ES5, for example ..

 mapping: function (mappingObj, searchMap) { if (!searchMap) searchMap = false; } 
+8
source
 var searchMap = false; mapping: function(mappingObj, searchMap) { // code } mapping(mappingObj, searchMap); 
0
source

All Articles