I was just playing around with for...of and tried to see how intuitive it was to get both the key and value of an entity being looped on and got to the following state:
for (var divEntries of Array.from(document.querySelectorAll('div')).entries()) {
console.log(divEntries[0]); // Key
console.log(divEntries[1]); // Value
}
Is there a better way to do this which would be a bit more semantic than using array positions on entries?
querySelectorallare iterable anyway. You don't need thatArray.fromfor of:-/for...ofthough