Created
April 21, 2020 18:30
-
-
Save allonsmandy/c970b4253f26539af65c4f68f7a8ee03 to your computer and use it in GitHub Desktop.
Revisions
-
allonsmandy created this gist
Apr 21, 2020 .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,19 @@ const exampleArray = [ [ [ 'value' ] ] ] // bad exampleArray.forEach((array1) => { array1.forEach((array2) => { array2.forEach((el) => { console.log(el) }) }) }) //good const retrieveFinalValue = (element) => { if(Array.isArray(element)) { return retrieveFinalValue(element[0]) } return element }