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 a, b | |
[a, b] = [1, 2] | |
console.log(a) // 1 | |
console.log(b) // 2 |
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 fazAlgumaCoisa = function ({nome, idade}) { | |
console.log('Meu nome é ' + nome + ' e minha idade é'+ idade) | |
} |
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 fazAlgumaCoisa = function (pessoa) { | |
var nome = pessoa.nome | |
var idade = pessoa.idade | |
console.log('Meu nome é ' + nome + ' e minha idade é'+ idade) | |
} |
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
let fazAlgumaCoisa = function() { | |
this.alguem = 'Legolas' | |
return { | |
fazExercicio: () => { | |
console.log(this.alguem + ' está dormindo') | |
} | |
} | |
} |
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
let fazAlgumaCoisa = function() { | |
this.alguem = 'Legolas' | |
return { | |
fazExercicio: function() { | |
console.log(this.alguem + ' está dormindo') | |
} | |
} | |
} |
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
let arrowSimples = (nome, apelido) => 'Meu nome é ' + apelido + ', ' + nome | |
console.log( arrowSimples('James Bond', 'Bond') ); |
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
let funcaoArrow = (nome, apelido) => { | |
return 'Meu nome é ' + apelido + ', ' + nome; | |
}; | |
console.log( funcaoArrow('James Bond', 'Bond') ); |
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 funcaoVelha = function(nome, apelido) { | |
return 'Meu nome é ' + apelido + ', ' + nome; | |
} | |
console.log( funcaoVelha('James Bond', 'Bond') ); |
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
class SeresVivos { | |
dorme (nome) { | |
console.log(nome + ' ' + 'está dormindo') | |
} | |
} | |
class Animal extends SeresVivos { | |
//Omitindo funções específicas do comportamento do cachorro | |
} |
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
class Pessoa { | |
constructor(nome, idade) { | |
this.nomePessoa = nome | |
this.idadePessoa = idade | |
} | |
//Omitindo as funções desnecessárias | |
get getNome () { | |
return 'Meu nome é' + ' ' + this.nomePessoa |