SCRIPT1006: Expected ')'

前端 未结 4 1909
星月不相逢
星月不相逢 2021-02-19 16:44

In the function below, IE says that \')\' is missing:

function padZeros(num, size = 4) {
    var s = num+\"\";
    while (s.length < size) {
        s = \"0\"         


        
4条回答
  •  隐瞒了意图╮
    2021-02-19 17:02

    This is happening because you are trying to run the Javascript ES6 code on non supported IE browser.

    ECMAScript 6, also known as ECMAScript 2015, is the latest version of the ECMAScript standard. ES6 is a significant update to the language, and the first update to the language since ES5 was standardized in 2009.

    Please go through the below docs for more details

    Funtion with default value : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters#Syntax

    Supported Browser Lists : https://kangax.github.io/compat-table/es6/

    Here is the update code for all browsers

提交回复
热议问题