I've worked on a generic Set polyfill. It is quite a simple task to
build one but determining if an object is in the set is O(n) with the
following "has" method.

    Set.prototype.has = function(element) {
        for (var i = 0, ilen = this._elements.length; i < ilen; i++) {
            if (element === this._elements[i]) {
                return true;
            }
        }
        return false;
    };

It seems like a long shot but is there some trick that someone has
discovered that allows for a more efficient generic Set polyfill?

Thanks,
Peter
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to