Created
October 1, 2015 14:13
-
-
Save salvianoo/e79c96e5f71d9ea68c54 to your computer and use it in GitHub Desktop.
Exemplo JS OO
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 App = App || {}; | |
App.Person = function(name, age) { | |
this.name = name; | |
this.age = age; | |
}; | |
App.Person.prototype.getName = function() { | |
return this.name; | |
}; | |
App.Person.prototype.getAge = function() { | |
return this.age; | |
}; | |
var user = new App.Person("Arthur", 56); | |
var nameUser = user.getName(); | |
var ageUser = user.getAge(); | |
console.log(nameUser, ageUser); //=> Arthur 56 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment