Created
September 14, 2019 15:16
-
-
Save anthonybrown/735ecf75e272570d32134375e9616ccd to your computer and use it in GitHub Desktop.
Revisions
-
anthonybrown created this gist
Sep 14, 2019 .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,13 @@ function getFirstLast(array) { const { 0: first, length: len, [len - 1]: last } = array return {first, last} } getFirstLast('Apple') getFirstLast(['apples', 'grapes', 'peaches', 'pears', 'cherries'])