You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
409 B

4 years ago
  1. # `max()`
  2. The max method returns the maximum value of a given key:
  3. ```js
  4. const collection = collect([
  5. {
  6. value: 10,
  7. },
  8. {
  9. value: -13,
  10. },
  11. {
  12. value: 12,
  13. },
  14. {
  15. unicorn: false,
  16. },
  17. ]);
  18. const max = collection.max('value');
  19. // 12
  20. ```
  21. ```js
  22. collect([-1, -2345, 12, 11, 3]).max();
  23. // 12
  24. ```
  25. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/max.js)