Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var Person = function(name) { = name;
Person.prototype.hi = function() {
return 'hi, my name is ${}';
var bob = new Person('Bob');
console.log(bob.hi()); //Hi, my name is Bob
class Person {
constructor(name) { = name;
hi() {
return 'Hi, my name is ${}';
var tom = new Person('Tom');
console.log(tom.hi()); //Hi, my name is Tom
console.log(typeof Person); //function
class Noisy extends Person {
hi() {
return '${super.hi()}!!!!!!!!!';
var mike = new Noisy('Mike');
console.log(mike.hi()); //Hi, my name is Mike!!!!!!!!!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment