Skip to content

Instantly share code, notes, and snippets.

@timgarciaa
Created July 2, 2022 13:29
Show Gist options
  • Save timgarciaa/2db7763632ce8fcb7869deb47929eccb to your computer and use it in GitHub Desktop.
Save timgarciaa/2db7763632ce8fcb7869deb47929eccb to your computer and use it in GitHub Desktop.
Combine string of array using reduce
const fruits = ['apple', 'orange', 'banana'];
const result = fruits.reduce((current, next) => current + ' ' + next, 'test ');
console.log(result);
// test apple orange banana
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment