Created
February 24, 2020 04:39
-
-
Save jsmanifest/2cf29bdfcfe458721383d4f929d645a9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Frog(name) { | |
this.name = name | |
} | |
Frog.prototype.getTeeths = function() { | |
return 2 | |
} | |
Frog.prototype.lick = function(target) { | |
console.log(`I'm going lick you, ${target.name}. You better taste delicious`) | |
} | |
// Or with classes | |
class Frog { | |
constructor(name) { | |
this.name = name | |
} | |
getTeeths() { | |
return 2 | |
} | |
lick(target) { | |
console.log( | |
`I'm going lick you, ${target.name}. You better taste delicious`, | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment