Skip to content

Instantly share code, notes, and snippets.

@rxluz
Last active January 20, 2019 06:50
Show Gist options
  • Save rxluz/1a06c658d2763119522f94eba4239b51 to your computer and use it in GitHub Desktop.
Save rxluz/1a06c658d2763119522f94eba4239b51 to your computer and use it in GitHub Desktop.
Big O in JS: The basic that you need to know, see more at: https://medium.com/p/a5abb45570fa
const printItemAndNext = (...items) =>
items.forEach((item, index) =>
items.forEach(
(innerItem, innerIndex) =>
innerIndex === index + 1 && console.log(item, innerItem),
),
);
/* will return:
1 2
2 3
3 4
*/
printItemAndNext(1, 2, 3, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment