Created
November 11, 2016 00:42
-
-
Save victorvhpg/1df0d08fc775300c33b3fce6c28e2c9a 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
| //Declaração | |
| class Pessoa { | |
| constructor(nome) { | |
| this.nome = nome; | |
| } | |
| getNome() { | |
| return this.nome; | |
| } | |
| }; | |
| //Declarando com expressão | |
| var Pessoa = class { | |
| constructor(nome) { | |
| this.nome = nome; | |
| } | |
| getNome() { | |
| return this.nome; | |
| } | |
| }; | |
| //Declarando com expressão nomeada | |
| var Pessoa = class PessoaXXX { | |
| constructor(nome) { | |
| this.nome = nome; | |
| } | |
| getNome() { | |
| return this.nome; | |
| } | |
| }; | |
| //Criando uma instancia singleton com execução imetiata da class | |
| var objPessoa = new class { | |
| constructor(nome) { | |
| this.nome = nome; | |
| } | |
| getNome() { | |
| return this.nome; | |
| } | |
| }("Nome do Fulano"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment