Created
October 18, 2020 23:25
-
-
Save oscaroceguera/8cb2e37348e9ceb68d3c8347911c1bc2 to your computer and use it in GitHub Desktop.
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 countSmileys(arr) { | |
let count = 0; | |
let validFace = [ | |
":)", | |
";)", | |
":-)", | |
";-)", | |
":~)", | |
";~)", | |
":D", | |
";D", | |
":-D", | |
";-D", | |
":~D", | |
";~D" | |
]; | |
arr.map(item => { | |
validFace.map(vitem => { | |
if (item.includes(vitem)) count++; | |
}); | |
}); | |
return arr.length == 0 ? 0 : count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment