Created
February 10, 2016 20:11
-
-
Save juanmaguitar/7e8a0e72604fe1a53b1b to your computer and use it in GitHub Desktop.
javascript-examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good Example