Skip to content

Instantly share code, notes, and snippets.

@michaelficarra
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelficarra/c553d6ebc5a44611ce4f to your computer and use it in GitHub Desktop.
Save michaelficarra/c553d6ebc5a44611ce4f to your computer and use it in GitHub Desktop.
ES6 Set.prototype.map issue
var set = new Set([0, 1]),
f = function(x) { return 1 / x; },
g = function(x) { return x ? -0 : x; };
set.map(g); // Set{0}
set.map(g).map(f); // Set{1/0}
set.map(function(x){ return f(g(x)); }); // Set{1/0, -1/0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment