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
src/ | |
service/ | |
consultaLivroService.js |
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
function Conta(options) { | |
//atributos privados | |
var options = options; | |
//Metodos publicos [OBJETO CONTA] | |
return { | |
saca: function(valor) { | |
if (valor <= 0) throw "Valor deve ser maior de ZERO!"; | |
if (options.saldo >= valor) { |
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
//Criando uma função construtora para simular uma classe: Person. | |
function Person(options) { | |
//attributos públicos | |
this.name = options.name; | |
this.gender = options.gender; | |
//métodos públicos | |
this.speak = function() { | |
console.log(this.name + ' sabe falar!'); | |
}; |