JavaScript difference between function and new function

后端 未结 2 1929
长情又很酷
长情又很酷 2020-11-29 03:53

The following JavaScript code is very confusing to me. Could anyone help me understand. Why does PersonY not have prototype property.

PersonX = function(){};         


        
2条回答
  •  抹茶落季
    2020-11-29 04:50

    That's because it is actually a object instantiated in memory as a copy of the function; the prototype really only has meaning in the context of a creation of the instance, so once it is created, there is no logical construct for what that means.

提交回复
热议问题