Dynamic

Array.from vs Array.prototype.slice

Developers should use Array meets developers should use array. Here's our take.

🧊Nice Pick

Array.from

Developers should use Array

Array.from

Nice Pick

Developers should use Array

Pros

  • +from when they need to convert array-like objects (e
  • +Related to: javascript, es6

Cons

  • -Specific tradeoffs depend on your use case

Array.prototype.slice

Developers should use Array

Pros

  • +prototype
  • +Related to: javascript-arrays, array-prototype-splice

Cons

  • -Specific tradeoffs depend on your use case

The Verdict

These tools serve different purposes. Array.from is a method while Array.prototype.slice is a methodology. We picked Array.from based on overall popularity, but your choice depends on what you're building.

🧊
The Bottom Line
Array.from wins

Based on overall popularity. Array.from is more widely used, but Array.prototype.slice excels in its own space.

Disagree with our pick? nice@nicepick.dev