Skip to content

Instantly share code, notes, and snippets.

@zzarcon
Created September 26, 2016 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzarcon/bbebebc16bd3a3cf10819d37fb48816d to your computer and use it in GitHub Desktop.
Save zzarcon/bbebebc16bd3a3cf10819d37fb48816d to your computer and use it in GitHub Desktop.
new.target
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