This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Checks that `toString` of constructor's prototype has "special" behavior (i.e. is `Object.prototype.toString`) as per 15.2.4.2 | |
Cons: | |
- Relies on `constructor` property of an object (as well as `toString` of constructor's prototype) being present and not augmented | |
(will fail on host objects in IE that lack constructor, but could be guarded against) | |
- Does not differentiate between Object objects created implicitly via function constructor and those created explicitly via Object | |
Pros: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* can you spot what is happening here */ | |
/* the alert("X") should never execute */ | |
<script> | |
onload = function() { | |
var fn = function() { | |
alert("X"); | |
} | |
(function() { })(); |
NewerOlder