Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment