This problem been there for couple years.
I am writing some plugins for a Forum engine called Discuz, I use a lot of Mootools for my own projects. When I plug Mootoo
Mootools extends Array.prototype
and maybe even Object.prototype
, which can interfere with for .. in
loops, which enumerate all properties, even those that exist in the object because they appear upwards on the prototype chain. Therefore, test if the property is a direct property of the object before using it:
for(i in a)
if (a.hasOwnProperty(i))
console.log(i);