79734852

Date: 2025-08-14 00:37:11
Score: 0.5
Natty:
Report link

I think you want the in operator, but I haven't tested the following:

for (let idx = 0; idx < collection.length; idx++) {
  const localIdx = idx;
  if (idx in collection) {
    collection[localIdx] = collection[localIdx] * 2;
  }
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Lea de Groot