For if loop vs forEach

The traditional for loop is the fastest, so you should always use that right? Not so fast — performance is not the only thing that matters. It is rare that you will ever need to loop over 1 million items in a frontend JS app. Code Readability is usually more important, so default to the style that fits your application.

3 Likes