As per the jQuery api, the complementary operation to .get(), which accepts an index and returns a DOM node, .index() can take a DOM node and returns an index.
.index()
Index can be found in this way
Array.from(children).findIndex(element => element.id === "bar")