Last active
February 20, 2017 12:45
-
-
Save vko-online/0d3dd0e384323857da7da0c8cc66c285 to your computer and use it in GitHub Desktop.
cv task
This file contains hidden or 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
function flat(arr, old) { | |
var plain = old || []; | |
arr.reduce(function(prev, curr) { | |
if(curr instanceof Array) { | |
return flat(curr, plain); | |
} else { | |
plain.push(curr); | |
return plain; | |
} | |
}, plain); | |
return plain; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment