You need to give like this:
"someNinja: " + (someNinja instanceof TrueNinja);
The reason is, the whole "someNinja: " + someNinja
is compared with TrueNinja
.
So, this way, it compares, "someNinja: " + someNinja
With the TrueNinja
, where, the former is string
and latter is TrueNinja
. Hope it is clear! :)
The actual reason is because of Operator Precedence, where +
comes before instanceof
.