Skip to content

Instantly share code, notes, and snippets.

@schabluk
Created May 16, 2017 12:37
Show Gist options
  • Save schabluk/8c5c36820a501a84122fecd7889735f3 to your computer and use it in GitHub Desktop.
Save schabluk/8c5c36820a501a84122fecd7889735f3 to your computer and use it in GitHub Desktop.
Getting index of node in HTMLCollection
const children = [].slice.call(this.snippetsList.node.children)
console.log(
data.node,
children.indexOf(data.node)
)
@lorint
Copy link

lorint commented Dec 12, 2018

Could be slightly leaner to do:
const children = Array.prototype.slice.call(this.snippetsList.node.children);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment