Created
May 23, 2019 07:29
-
-
Save kuldeepkeshwar/e7d8f4ffffc5b88b77260a761f01e73e to your computer and use it in GitHub Desktop.
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 flatten(arr){ | |
return arr.reduce((result,item)=>{ | |
if(Array.isArray(item)){ | |
result=result.concat(flat(item)) | |
}else{ | |
result.push(item) | |
} | |
return result; | |
},[]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment