Skip to content

Instantly share code, notes, and snippets.

@dashcraft
Created November 22, 2017 15:52
Show Gist options
  • Save dashcraft/7ebe57ae28232a9b6b8df00d060957c3 to your computer and use it in GitHub Desktop.
Save dashcraft/7ebe57ae28232a9b6b8df00d060957c3 to your computer and use it in GitHub Desktop.
Reduce example
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