Skip to content

Instantly share code, notes, and snippets.

@alexeden
Last active April 17, 2019 17:41
Show Gist options
  • Select an option

  • Save alexeden/48d081e6d4f8f23c9d09cf609c62ef9b to your computer and use it in GitHub Desktop.

Select an option

Save alexeden/48d081e6d4f8f23c9d09cf609c62ef9b to your computer and use it in GitHub Desktop.
Notes for the Data Transformation problems

Data transformations

Essential Array Methods

These are the JS Array methods that should be your go-to tools for everything. They're the building blocks of some extremely powerful combinations of algorithmic logic.

Prototype methods (methods called on an instance of an Array)

Static methods (methods called on the Array constructor directly)

Irrelevant Array Methods

These are the Array methods that are fine to use, and at one point were used all the time, but they have since been made irrelevant by new JS language features.

Banned Array Methods

These the JS Array methods that should be avoided and ideally removed from your vocabulary. They either encourage imperative code or, even worse, they mutate state.

  • [].forEach: Imperative code enabler
  • [].pop: Mutates
  • [].push: Mutates
  • [].splice: Mutates
  • [].shift: Mutates
  • [].unshift: Mutates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment