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
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
It should be "for … of". If the intention is to iterate over the array indices, that's better done with values.forEach or a traditional for (let i = 0; i < values.length; i++) loop. Both of these alternatives give you numeric indices, rather than the strings that "for ... in" does.
Some people advocate disallowing for-in entirely, but I still find it useful for objects.
In theory tslint should know whether the object being iterated over is really an array and it could warn specifically on this mistake.
The text was updated successfully, but these errors were encountered:
This is almost certainly an error:
It should be "for … of". If the intention is to iterate over the array indices, that's better done with
values.forEach
or a traditionalfor (let i = 0; i < values.length; i++)
loop. Both of these alternatives give you numeric indices, rather than the strings that "for ... in" does.Some people advocate disallowing for-in entirely, but I still find it useful for objects.
In theory tslint should know whether the object being iterated over is really an array and it could warn specifically on this mistake.
The text was updated successfully, but these errors were encountered: