Javascript Functions and default parameters, not working in IE and Chrome

前端 未结 5 1653
臣服心动
臣服心动 2020-12-01 02:22

I created a function like this:

function saveItem(andClose = false) {

}

It works fine in Firefox

In IE it gives this error on the

5条回答
  •  情书的邮戳
    2020-12-01 03:03

    That's not a valid ECMAScript syntax, but it is a valid syntax for Mozilla's superset of features they add to their implementation of the language.

    Default parameter assignment syntax is likely coming in ECMAScript 6.

提交回复
热议问题