Aula 7 - Métodos estáticos

OOP Javascript - ES5

function Person() { var name; var age; var height; this.sayHello = function (name) { console.log('Hello ' + name); }; this.hello = function hello(name) { console.log('Hello ' + name); }; this.getName = function getName() { return name; }; this.setName = function setName(_name) { name = _name; }; this.getAge = function () { return age; }; this.setAge = function (_age) { age = _age; }; this.getHeight = function getHeight() { return height; }; this.setHeight = function setHeight(_height) { height = _height; }; } Person.static_method = function () { console.log('This is my first static method'); }; Person.static_method(); Person.static_attr = 'My first static attribute'; console.log(Person.static_attr); var jean = new Person(); jean.setName('Jean'); jean.setAge(48); jean.setHeight(1.76); console.log(jean); console.log(jean.name); jean.sayHello(jean.getName()); var victor = new Person();