Ship internal tools in hours, not weeks. Real auth, users, jobs, audit logs, and cohesive UI included. Early access $249 $499 → [Get it now]

How to use for...of loop in JavaScript

Iterating over collections is a fundamental task in JavaScript, yet choosing the right loop can be confusing for many developers.
With over 25 years of experience in software development and as the creator of CoreUI, I’ve seen iteration patterns evolve from complex for loops to the elegant ES6 for...of syntax.
In modern development, for...of is the most readable and efficient way to traverse iterable objects like arrays, strings, and maps.
This method provides a clean abstraction that avoids the boilerplate of index management while maintaining full support for control statements.

Read More…

How to use for...in loop in JavaScript

Iterating over object properties is a fundamental task in JavaScript, yet many developers struggle with the nuances of property enumerability and prototype inheritance.
With over 25 years of experience in software development and as the creator of CoreUI, I’ve utilized various iteration patterns to build high-performance UI components since the early days of the web.
The for...in loop remains the most direct way to traverse the enumerable string properties of an object, including those inherited from its prototype chain.
Understanding when and how to use this loop is critical for writing clean, efficient, and bug-free code in modern JavaScript environments.

Read More…
Subscribe to our newsletter
Get early information about new products, product updates and blog posts.

Answers by CoreUI Core Team