Last active
December 25, 2017 16:14
-
-
Save carl-parrish/e7294641065ffef4d05c268b36c5837c to your computer and use it in GitHub Desktop.
Revisions
-
carl-parrish renamed this gist
Dec 25, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
carl-parrish renamed this gist
Dec 25, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
carl-parrish revised this gist
Dec 25, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ ```js /******************** ** Write some code, that will flatten an array ** of arbitrarily nested arrays of integers @@ -12,4 +13,5 @@ function flatten(source){ return answer; } const myArray = [[1,2,[3]],4]; console.log(flatten(myArray)); // [1,2,3,4] ``` -
carl-parrish revised this gist
Feb 17, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ var answer = []; function flatten(source){ source.map(val => Array.isArray(val)? flatten(val) : answer.push(val)); return answer; } const myArray = [[1,2,[3]],4]; -
carl-parrish revised this gist
Feb 17, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,5 +11,5 @@ function flatten(source){ source.forEach(val => Array.isArray(val)? flatten(val) : answer.push(val)); return answer; } const myArray = [[1,2,[3]],4]; console.log(flatten(myArray)); // [1,2,3,4] -
carl-parrish revised this gist
Sep 18, 2016 . No changes.There are no files selected for viewing
-
carl-parrish revised this gist
Sep 18, 2016 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,10 @@ /******************** ** Write some code, that will flatten an array ** of arbitrarily nested arrays of integers ** into a flat array of integers. ** e.g. [[1,2,[3]],4] -> [1,2,3,4] ************************/ var answer = []; function flatten(source){ -
carl-parrish created this gist
Sep 17, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ var answer = []; function flatten(source){ source.forEach(val => Array.isArray(val)? flatten(val) : answer.push(val)); return answer; } console.log(flatten(myArray));