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.

21 lines
432 B

4 years ago
  1. # `join()`
  2. The join method joins the collection's values with a string:
  3. ```js
  4. collect(['a', 'b', 'c']).join(', ');
  5. // 'a, b, c'
  6. collect(['a', 'b', 'c']).join(', ', ', and ');
  7. // 'a, b, and c'
  8. collect(['a', 'b']).join(', ', ' and ');
  9. // 'a and b'
  10. collect(['a']).join(', ', ' and ');
  11. // 'a'
  12. collect([]).join(', ', ' and ');
  13. // ''
  14. ```
  15. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/join.js)