Skip to content

Instantly share code, notes, and snippets.

@mthadley
Created December 6, 2016 01:44
Show Gist options
  • Save mthadley/b0deb99ba9f2014128abcb25fbf4a1d2 to your computer and use it in GitHub Desktop.
Save mthadley/b0deb99ba9f2014128abcb25fbf4a1d2 to your computer and use it in GitHub Desktop.
concat vs union
const {OrderedSet} = Immutable;
const x = OrderedSet([]);
const y = OrderedSet([2, 3, 4, 5, 6]);
const z = x.concat(y);
console.log(z === y);
// This will log `false`.
//
// However if we call `union` instead, it will log `true`.
//
// I think both results make sense for their context, `concat` coming
// from Lists and `union` coming from Sets. I think we want to be
// calling `concat` most of the time here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment