Forum Academy Marketplace Showcase Pricing Features

For if loop vs forEach

Does anyone know if there are any issues using forEach loops in code with bubble plugin editor?

1 Like

I use Array.forEach() pretty regularly. Shouldn’t be an issue.

Are you having a hard time getting either to work?

No issues as yet, just want to make sure using the best type of loop before get to far forward.

https://levelup.gitconnected.com/which-is-faster-for-for-of-foreach-loops-in-javascript-18dbd9ffbca9

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

Here’s some input on that. https://stackoverflow.com/a/49105977