Created
November 25, 2019 14:27
-
-
Save sag1v/c914c41c2e69df7fb9083f8cc790e8ba to your computer and use it in GitHub Desktop.
Markdium-JavaScript - The prototype chain in depth
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 Player(username, score){ | |
if(!(this instanceof Player)){ | |
throw new Error('Player must be called with new') | |
} | |
// ES2015 syntax | |
if(!new.target){ | |
throw new Error('Player must be called with new') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment