Closed tylermarien closed 2 years ago
Latest commit: f06f9a5b78099aea7e33c693db741f45bee5c24d
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Hooray! All contributors have signed the CLA.
Thank you 🙏🏽
Using a for...in loop on an array is prone to errors because it loops over all enumerable properties (including functions). If another library adds a function to the Array prototype, then this breaks because it will include that function. This was happening in our case. Another library was modifying the Array prototype and causing errors in this code.
We could fix the problem by replacing the for...in loop with a for...of loop, but map is probably a better solution here since we are modifying every element in the array. I have changed the for...in loop to a map.
Difference between for...of and for...in