Created
November 22, 2017 15:52
-
-
Save dashcraft/7ebe57ae28232a9b6b8df00d060957c3 to your computer and use it in GitHub Desktop.
Reduce example
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
const arr = ['a','aab','bbc','aass'] | |
let newArr = arr.reduce(function (str, item) { | |
if (item.includes('a')) { | |
console.log(item) | |
str = str + item; | |
} | |
return str; | |
}, ''); | |
newArr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment