You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If my program contains custom properties for Array, then CheckInput() throws a "TypeError: userColors[color].toLowerCase() is not a function" error. This is because for (var color in userColors) iterates over both the array elements and the custom properties. I believe changing for...in to for...of will fix it. To reproduce:
Hi @andrewwalters
Changing the prototype of native objects you don't have ownership over is a big no-no and largely considered an anti pattern because it can effect other code like libraries ironically illustrated by your submitted issue. But I know that some old code bases did this and we don't always have the luxury of rebuilding everything or working with modern code so I had a look and since my code here was a bit old I decided to rewrite the loops from for in to forEach which make much more sense here :)
That will incidentally also fix your issue and is now live with v2.1.3.
If my program contains custom properties for Array, then CheckInput() throws a "TypeError: userColors[color].toLowerCase() is not a function" error. This is because
for (var color in userColors)
iterates over both the array elements and the custom properties. I believe changing for...in to for...of will fix it. To reproduce:The text was updated successfully, but these errors were encountered: