Created
July 7, 2020 19:01
-
-
Save fehmathais/f81b96a28b2132835a3948b95107bde8 to your computer and use it in GitHub Desktop.
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
//objeto cachorro com função de latir | |
//contador 0 a 100 usando o loop "for" | |
var produto = { | |
nome: 'Serra elétrica', | |
preco: 21.09, | |
quantidade: 10, | |
comprar: function (quantidade) { | |
if (produto.quantidade > 0 && quantidade <= produto.quantidade) { | |
return produto.quantidade - quantidade; | |
} else { | |
return 'Não há quantidade disponível em estoque'; | |
} | |
} | |
} | |
console.log(produto.comprar(9)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment