Ad
  • Default User Avatar

    for...in loops over enumerable properties. That means if any method was added to Array.prototype incorrectly or lazily (or on purpose) that was enumerable, it would show up in the loop (and is probably undesired).

  • Default User Avatar

    w isn't declared anywhere, so you're creating a global variable. And using for...in with arrays isn't usually a good idea (even if it worked in your solution). Either use a normal for loop or one of the Array.prototype methods.