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 the new
keyword?
Example:
function Foo () {
return something;
}
var foo = new Foo ();
If I'm not mistaken, if something
is a non-function primitive, this
will be returned. Otherwise something
is returned. Is this correct?
In other words, what values can something
take to cause (new Foo () instanceof Foo) === false
?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…