Skip to content

Instantly share code, notes, and snippets.

@dainiuxt
Created February 6, 2021 16:24
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 dainiuxt/14242e8ff5e6d183e6e8a843f0985e45 to your computer and use it in GitHub Desktop.
Save dainiuxt/14242e8ff5e6d183e6e8a843f0985e45 to your computer and use it in GitHub Desktop.
function Player(name, marker) {
this.name = name
this.marker = marker
this.sayName = function() {
console.log(name)
}
}
const player1 = new Player('steve', 'X')
const player2 = new Player('also steve', 'O')
player1.sayName() // logs 'steve'
player2.sayName() // logs 'also steve'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment