Default value of a type in javascript

前端 未结 3 1655
太阳男子
太阳男子 2021-02-15 00:55

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:22

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

    var defaultValue = void 0;
    

提交回复
热议问题