'lodash's each not setting value for each item
I'm using lodash's each function to set some property on each item of my collection.
L1 each(forms, form => form.isEditMode = false);
L2 each(forms, form => form.uuid = Math.random());
L1 doesn't work. L2 works.
Solution 1:[1]
L1 basically never runs after the first item because as per docs Iteratee functions may exit iteration early by explicitly returning false. and assignment of false means it returns false.
I was pulling my hair until I got it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | pranavjindal999 |
