Skip to content

Instantly share code, notes, and snippets.

@juanmaguitar
Created February 10, 2016 20:11
Show Gist options
  • Save juanmaguitar/7e8a0e72604fe1a53b1b to your computer and use it in GitHub Desktop.
Save juanmaguitar/7e8a0e72604fe1a53b1b to your computer and use it in GitHub Desktop.
javascript-examples
var Person = function(x){
if(x){this.fullName = x};
};
Person.prototype.whatIsMyFullName = function() {
return this.fullName;
}
var cody = new Person('cody lindley');
var lisa = new Person('lisa lindley');
console.log(cody.whatIsMyFullName(), lisa.whatIsMyFullName());
Object.prototype.fullName = 'John Doe';
var john = new Person();
console.log(john.whatIsMyFullName());
@sahudeepakhhh
Copy link

Good Example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment