Last active
August 30, 2018 02:20
-
-
Save JorgeMadson/c502041944b3f2d8970bcf6b572d9138 to your computer and use it in GitHub Desktop.
Revisão Javascript Programação Funcional Array 2 - some, mas é igual com every
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
| // Usando o array anterior | |
| var prova = [{ aluno: 'Fogaça', nota: 9.5 }, | |
| // ... | |
| ]; | |
| var alguemRodou = prova.some(function (item) { | |
| return item.nota < 8; | |
| }); | |
| //Usando if ternário para mostrar o resultado e deixar o código mais limpo. | |
| console.log(alguemRodou | |
| ? 'Tem gente que não passou na prova.' | |
| : 'Todo mundo passou! /o/'); | |
| // Resultado: | |
| // Tem gente que não passou na prova. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment