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
483 B

4 years ago
  1. # `forget()`
  2. The forget method removes an item from the collection by its key:
  3. ```js
  4. const collection = collect({
  5. name: 'Steven Gerrard',
  6. number: 8,
  7. });
  8. collection.forget('number');
  9. collection.all();
  10. // {
  11. // name: 'Steven Gerrard',
  12. // }
  13. ```
  14. > Unlike most other collection methods, forget does not return a new modified collection; it modifies the collection it is called on.
  15. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/forget.js)