Skip to content

Instantly share code, notes, and snippets.

@hartraft
Created December 20, 2017 16:53
Show Gist options
  • Save hartraft/98cd60c790f0d78f0bbe48d7eb398a63 to your computer and use it in GitHub Desktop.
Save hartraft/98cd60c790f0d78f0bbe48d7eb398a63 to your computer and use it in GitHub Desktop.
// from() – determine the result’s constructor via the receiver
// (in this case, MyArray)
let instanceOfMyArray = MyArray.from([1, 2, 3], x => x * x);
// map(): the result is always an instance of Array
let instanceOfArray = [1, 2, 3].map(x => x * x);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment