Array.prototype.__iterator__ = function(isKey) { var self = this; return (isKey ? i[0] : i[1] for (i in new Iterator(self))); }; for(var i in [1, 2, 3]) console.log(i); // 0, 1, 2 これで、Arrayに対しても安心してfor..inを使うことができる。 あと、XPathResultのprototypeに XPathResult.prototype.__iterator__ = function(){ switch(this.resultType){ case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE: case XPathResult.UNORDERED_NODE_SNAPSHO