简体   繁体   中英

Querying for non existent property doesn't always throw error

Why when executing this piece of code, only checking for thisThrowsError actually throws error, but querying for non existent property on the prototype object or on this context doesn't?

function Test()
{

    if(this.someVar){}
    if(Test.prototype.someVar){}  
    if(thisThrowsError){}
 }

var test = new Test();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM