Created
February 21, 2020 01:48
-
-
Save brenofreire/7365cb0c465b826bca350d64c1d4e67f to your computer and use it in GitHub Desktop.
Conta quantos items são verdadeiros em um array
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
// O array filter do JS te ajuda muito quando você quer fazer uma seleção específica (filtro ;) | |
function countSheeps(arrayOfSheeps) { | |
return arrayOfSheeps.filter(Boolean).length; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment