Skip to content

Instantly share code, notes, and snippets.

@salvianoo
Created October 1, 2015 14:13
Show Gist options
  • Save salvianoo/e79c96e5f71d9ea68c54 to your computer and use it in GitHub Desktop.
Save salvianoo/e79c96e5f71d9ea68c54 to your computer and use it in GitHub Desktop.
Exemplo JS OO
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