-2

I have the followig function inside my javascript file:-

function showOrHideField(curField="") {

where i am defining a function which take a parameter with defualt value "", now this is working well on Firefox. but on IE11 i got the following exception:-

SCRIPT1006: Expected ')'

so can anyone advice on this please? Thanks

John John
  • 1
  • 72
  • 238
  • 501
  • 1
    because IE11 does not support that feature https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters#Browser_compatibility – epascarello May 25 '17 at 22:53

1 Answers1

1

IE11 does not support default parameters

function showOrHideField(curField="") {

would need to be

function showOrHideField(curField) {
   curField = curField || "";
   //or
   curField = curField!==undefined ? curField : "";
epascarello
  • 204,599
  • 20
  • 195
  • 236