; {
const values = [1, 2, 3, 4, 5].values()
for (const value of values) {
if (value % 2) values.next()
console.log(value)
}
}

just legitimately had to use this technique; a·m·a

@aescling because i needed to skip some iterations in a for…of loop?

Follow

@aescling

const pipesIterator = Object.entries(pipes).values();

for (const [pipeNº, index] of pipesIterator) {
/* … */
let nextPipeNº = pipeNº;
while (pipes[++nextPipeNº] < lastIndex) {
// skip pipes which precede lastIndex
if (pipesIterator.next().done) {
break;
} else {
continue;
}
}
}

· · Web · 1 · 0 · 0

@aescling oh i guess there is an Array::entries() method which i could be using instead of Object.entries(…).values() but same thing

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.