Negation of instanceof gives unexpected results

Viewed 168

What is the difference between these two statements? They give different output (in google chrome console).

function Test() {
    if (this instanceof Test) {

    } else {
        return new Test();
    }
}
x = Test();

Test {}

function Test() {
    if (!this instanceof Test) {
        return new Test();
    }
}
x = Test();

undefined

Mind = boggled

1 Answers
Related