DEV Community

Cover image for forEach loop
GiandoDev
GiandoDev

Posted on

1

forEach loop

Alt Text
In my opinion, forEach loop is super cool, elegant and short.
In the code above you may see that forEach loop takes three arguments, but most of the time you will only use the current value to do stuff.
Alt Text
We may use a call back to make a code shorter or the normal function.
Alt Text
If we need to show the index we can do this.
Alt Text
It`s fun and simple. If you want to know more about forEach loop here is the link
forEach loop MDN

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay