For
1 minute read
test
TypeScript supports three looping constructs:
for loop - the classic way to loop.
for..of loop - for looping over iterable objects
for..in loop - for looping over object properties
Iterating over collections of something is such a common programming task, you will often find yourself using the for..of loop.
You’ll find yourself using the classic for loop mostly in situations where its syntax streamlines access to a loop counter that’s essential to your code implementation.
You will rarely need to iterate over an object’s properties, but when you do, you’ll see that you can still use a for..of loop instead of the more nuanced, legacy for..in loop.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.