Skip to content

Instantly share code, notes, and snippets.

@kristyburge
Last active July 27, 2018 23:33
Show Gist options
  • Save kristyburge/fb827103251f84a8aa0e12826f61456b to your computer and use it in GitHub Desktop.
Save kristyburge/fb827103251f84a8aa0e12826f61456b to your computer and use it in GitHub Desktop.
Create a object type with a constructor function and see 'this' in action
function Dog(breed, name, friends){
this.breed = breed;
this.name = name;
this.friends = friends;
this.intro = function() {
console.log(`Hi, my name is ${this.name} and I’m a ${this.breed}`);
return this;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment