Skip to content

Instantly share code, notes, and snippets.

@night-fury-rider
Last active September 9, 2020 10:20
Show Gist options
  • Save night-fury-rider/2e9707beeed5191daf4319c2ddaa8779 to your computer and use it in GitHub Desktop.
Save night-fury-rider/2e9707beeed5191daf4319c2ddaa8779 to your computer and use it in GitHub Desktop.
Design Pattern - Constructor
var Person = function(personName) {
this.name = personName;
};
var person1 = new Person('Yuvraj');
var person2 = new Person ('Arya');
console.log(person1.name); // Yuvraj
console.log(person2.name); // Arya
console.log(person1 === person2); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment