Default function parameter value in safari is not working

前端 未结 1 1446
谎友^
谎友^ 2021-01-04 10:47

I am using angularjs, and having problem with null assignment in safari only. Its working in chrome and firefox.

$scope.submit = function(id=nul         


        
1条回答
  •  别那么骄傲
    2021-01-04 11:33

    Default parameters from ES2015 are not yet supported in Safari. Please check the compatibility table.

    At the moment the basic support provide Chrome 49 and Firefox 15.


    But you can use the following ES5 code to achieve the same:

    $scope.submit = function(id) {
      if (id === undefined) {
        id = null;
      }
    }
    

    0 讨论(0)
提交回复
热议问题