Last active
June 29, 2016 06:52
-
-
Save Semigradsky/ac150f27e68933e3eff442345d92c01f to your computer and use it in GitHub Desktop.
This file contains 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
// Manually simulating an apply() for constructors | |
var arr = [2011, 11, 24]; | |
new (Function.prototype.bind.apply( | |
Date, [null].concat(arr))) | |
// Switching over an object’s constructor | |
try { | |
... | |
} catch (e) { | |
switch (e.constructor) { | |
case SyntaxError: | |
... | |
break; | |
case CustomError: | |
... | |
break; | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment