Snippet format update
To match the starter (for the migration)
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
### averageBy
|
||||
---
|
||||
title: averageBy
|
||||
tags: math,array,function,intermediate
|
||||
---
|
||||
|
||||
Returns the average of an array, after mapping each element to a value using the provided function.
|
||||
|
||||
@@ -13,4 +16,4 @@ const averageBy = (arr, fn) =>
|
||||
```js
|
||||
averageBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], o => o.n); // 5
|
||||
averageBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], 'n'); // 5
|
||||
```
|
||||
```
|
||||
Reference in New Issue
Block a user