Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-22 20:24:04 +03:00
parent aedcded750
commit d35575373f
41 changed files with 148 additions and 88 deletions

View File

@ -3,7 +3,7 @@ title: partitionBy
tags: array,object,advanced
---
Applies `fn` to each value in `arr`, splitting it each time `fn` returns a new value.
Applies `fn` to each value in `arr`, splitting it each time the provided function returns a new value.
- Use `Array.prototype.reduce()` with an accumulator object that will hold the resulting array and the last value returned from `fn`.
- Use `Array.prototype.push()` to add each value in `arr` to the appropriate partition in the accumulator array.