Skip to content

Instantly share code, notes, and snippets.

@sag1v
Created November 25, 2019 14:27
Show Gist options
  • Save sag1v/5970521a0230fcabf96622c410e62466 to your computer and use it in GitHub Desktop.
Save sag1v/5970521a0230fcabf96622c410e62466 to your computer and use it in GitHub Desktop.
Markdium-JavaScript - The prototype chain in depth
function Player(userName, score){
this.userName = userName;
this.score = score;
}
Player.prototype.setScore = function(newScore){
this.score = newScore;
}
const player1 = new Player('sag1v', 700);
const player2 = new Player('sarah', 900);
console.log(player1)
console.log(player2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment