Created
March 4, 2018 02:13
-
-
Save dance2die/c75ae463ad1f7b2fa0eee1f39d813e85 to your computer and use it in GitHub Desktop.
This file contains 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 spreadDemo(orders) { | |
const firstOrder = [orders[0]]; | |
const lastOrder = [[...orders].pop()]; | |
// spread operator "..." on each array does the same thing as "SelectMany" in LINQ. | |
const firstAndLastOrders = [...firstOrder, ...lastOrder]; | |
printOrders(firstAndLastOrders); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment