Default value of a type in javascript

前端 未结 3 2020
长情又很酷
长情又很酷 2021-02-15 00:48

Is there a function in JavaScript that returns the default value for a type name that is passed to it? For example:

var defaultValue = built_in_getDefaultValue(\         


        
3条回答
  •  面向向阳花
    2021-02-15 01:19

    The default value of any variable in javascript is undefined. You can also get it as

    var defaultValue = void 0;
    

提交回复
热议问题