Skip to content
This repository has been archived by the owner on May 15, 2022. It is now read-only.

Commit

Permalink
Atualizado Resumo
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarcon83 committed Mar 24, 2021
1 parent ae6979d commit 41dfe1c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions _JS - Objetos.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ Setters e Getters

Exemplo

const student = {
firstName: 'Monica',
get getName() { // getter
return this.firstName;
const aluno = {
nome: 'Monica',
get buscarNome() { // getter
return this.nome;
}
set mudarNome(novoNome) { // setter
this.nome = novoNome;
}
set changeName(newName) { // setter
this.firstName = newName;
}
};

student.getName -> retorna o firstName
student.setName("Pedro) -> muda o firsName
aluno.buscarNome -> Retorna o nome Monica
aluno.mudarNome("Pedro) -> muda o nome para Pedro

Obs: Podemos adicionar mais funcionalidade dentro de cada função,
conforme a necessidade.

0 comments on commit 41dfe1c

Please sign in to comment.