What values can a constructor return to avoid returning this?

前端 未结 6 714
傲寒
傲寒 2020-11-22 08:06

What are the exact circumstances for which a return statement in Javascript can return a value other than this when a constructor is invoked using

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 08:29

    When you are using the new keyword, an object is created. Then the function is called to initialise the object.

    There is nothing that the function can do to prevent the object being created, as that is done before the function is called.

提交回复
热议问题