Passing in NULL as a parameter in ES6 does not use the default parameter when one is provided

前端 未结 3 476
星月不相逢
星月不相逢 2020-12-24 04:53

Is there a known reason why passing in null as a parameter in ES6 does not use the default parameter when one is provided?

function sayHello(nam         


        
3条回答
  •  春和景丽
    2020-12-24 05:34

    null is a value that won't trigger the default value to be used, the default values will be used when the argument is undefined.

提交回复
热议问题