Created
September 26, 2016 07:28
-
-
Save zzarcon/bbebebc16bd3a3cf10819d37fb48816d to your computer and use it in GitHub Desktop.
new.target
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
function Foo() { | |
const t = eval('new.target'); | |
if (!t) throw "Foo() must be called with new"; | |
console.log("Foo instantiated with new"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment