SCRIPT1006: Expected ')'

前端 未结 4 1923
星月不相逢
星月不相逢 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:15

    In Microsoft Edge an d IE is not supported direct pass the value in function. It is consider as Error file, So that we are getting error

    Try below code

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

提交回复
热议问题