Skip to content

Instantly share code, notes, and snippets.

View bignimbus's full-sized avatar
🙃

Jeff Auriemma bignimbus

🙃
View GitHub Profile
@bignimbus
bignimbus / flattenAndAdd.js
Last active August 29, 2015 13:57
Given a JavaScript array, function flattens the array and returns the sum of all primitive-type numbers in the array. The function works recursively.
/*
Given a JavaScript array, function flattens the array and returns the sum of all primitive-type numbers in the array.
The function works recursively.
*/
function flattenAndAdd(arrayToFlatten) {
var originalArray = arrayToFlatten;
var repeat = 1;