Created
December 29, 2016 10:51
-
-
Save evandropsantos/8990a8b656814a13a17b0080cdd9cc75 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Pessoa{ | |
| constructor(nome, sobrenome){ | |
| this.nome = nome; | |
| this.sobrenome = sobrenome; | |
| } | |
| obtemNomeCompleto(){ | |
| return `${this.nome} ${this.sobrenome}`; | |
| } | |
| } | |
| var pessoa = new Pessoa('Lindomar', 'Clebersom'); | |
| console.log(pessoa.obtemNomeCompleto()); | |
| function Pessoa2(nome, sobrenome){ | |
| this.nome = nome; | |
| this.sobrenome = sobrenome; | |
| } | |
| Pessoa2.prototype.obtemNomeCompleto = function(){ | |
| return this.nome + ' ' + this.sobrenome; | |
| } | |
| var pessoa2 = new Pessoa2('Arlindo', 'Araujo'); | |
| console.log(pessoa2.obtemNomeCompleto()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment