Skip to content

Instantly share code, notes, and snippets.

@sag1v
Created November 25, 2019 14:27
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 sag1v/4ad878489d83e5292380ba56f64f0760 to your computer and use it in GitHub Desktop.
Save sag1v/4ad878489d83e5292380ba56f64f0760 to your computer and use it in GitHub Desktop.
Markdium-JavaScript - The prototype chain in depth
function PaidPlayer(userName, score, balance) {
this.balance = balance;
/* we are calling "Player" without the "new" operator
but we use the "call" method,
which allows us to explicitly pass a ref for "this".
Now the "Player" function will mutate "this"
and will populate it with the relevant properties */
Player.call(this, userName, score);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment