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.

29 lines
348 B

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