Reword some articles

This commit is contained in:
Chalarangelo
2021-11-06 21:00:44 +02:00
parent 04ee60671b
commit 4670439e56
3 changed files with 12 additions and 12 deletions

View File

@ -6,7 +6,7 @@ authors: chalarangelo
cover: blog_images/little-tree.jpg
excerpt: When working with numeric arrays in JavaScript, you might find yourself in need of finding the minimum or maximum value. Here's a quick and easy way to do it.
firstSeen: 2021-03-01T11:00:00+02:00
lastUpdated: 2021-06-12T19:30:41+03:00
lastUpdated: 2021-11-06T20:51:47+03:00
---
When working with numeric arrays in JavaScript, you might find yourself in need of finding the minimum or maximum value. Luckily, JavaScript's `Math` built-in object has got you covered. You can simply use `Math.min()` or `Math.max()` combined with the spread operator (`...`), as both functions accept any number of arguments.
@ -18,4 +18,4 @@ Math.max(...nums); // 8
Math.min(...nums); // 1
```
For more complex cases (i.e. finding the min/max value in an array of objects), you might have to resort to `Array.prototype.map()` or `Array.prototype.reduce()`, but our [minBy](/js/s/min-by) or [maxBy](/js/s/max-by) snippets might be all you need.
For more complex cases, such as finding the min/max value in an array of objects, you might have to resort to `Array.prototype.map()` or `Array.prototype.reduce()`. On the other hand, our [minBy](/js/s/min-by) or [maxBy](/js/s/max-by) snippets might be all you need.