Skip to content

Instantly share code, notes, and snippets.

@rxluz
Last active January 20, 2019 06:50
Show Gist options
  • Save rxluz/99eeb1048287c66d39590aef9c6c8608 to your computer and use it in GitHub Desktop.
Save rxluz/99eeb1048287c66d39590aef9c6c8608 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 printItemAndNextItem = (...items) =>
items.forEach(
(item, index) => items[index + 1] && console.log(item, items[index + 1]),
);
/* will return:
1 2
2 3
3 4
*/
printItemAndNextItem(1, 2, 3, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment