Skip to content

Instantly share code, notes, and snippets.

@brandonweis
Created October 7, 2020 08:28
Show Gist options
  • Save brandonweis/ad28aed04dd8c89043d232683660f224 to your computer and use it in GitHub Desktop.
Save brandonweis/ad28aed04dd8c89043d232683660f224 to your computer and use it in GitHub Desktop.
/*
# Coding exercise
Implement the array reduce function (including tests)
var arr1 = [1,2,3,4];
arr1.reduce((acc, value) => acc + value, 0); // 10
Extension: avoid using loops (use recursion)
*/
/*
# Intersection value between two arrays
e.g. intersection([1,2,3,4], [0,2,4,6]) → [2,4]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment