Skip to content

Instantly share code, notes, and snippets.

@ashwinkumar2438
Created June 19, 2021 17:47
Show Gist options
  • Save ashwinkumar2438/6c5d67e0bd4619ef8054992ef89aa681 to your computer and use it in GitHub Desktop.
Save ashwinkumar2438/6c5d67e0bd4619ef8054992ef89aa681 to your computer and use it in GitHub Desktop.
const Person=function(name){
this.name=name;
}
Person.prototype.run=function (){ return `${this.name} is running.`};
Person.prototype.sleep=function (){return `${this.name} is sleeping.`};
let woman=new Person('She');
let man=new Person('He');
woman.run(); // @returns "She is running."
man.sleep(); // @returns "He is sleeping."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment