---
title: "Discussion on \"Breaking out of a forEach loop in JavaScript\" | Hashnode"
description: "Discussion on \"Breaking out of a forEach loop in JavaScript\". In JavaScript we can use the break keyword to immediately stop iterating through a for loop. There is no equivalent for the forEach() loop, which is much more commonly used today.\nAn alternative that will achieve the same behavior is using the every(..."
url: "https://hashnode.com/posts/breaking-out-of-a-foreach-loop-in-javascript/614aea5f3a0af204bb9661d5"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Breaking out of a forEach loop in JavaScript](https://levpewpew.hashnode.dev/breaking-out-of-a-foreach-loop-in-javascript?utm_source=hashnode&utm_medium=feed)

In JavaScript we can use the break keyword to immediately stop iterating through a for loop. There is no equivalent for the forEach() loop, which is much more commonly used today. An alternative that will achieve the same behavior is using the every(...

Sep 22, 2021 · 1 min read · levpewpew.hashnode.dev  
Updated Aug 5, 2022  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#functional-programming](https://hashnode.com/tag/functional-programming)

## Written by

[Ramiel](https://hashnode.com/@LevPewPew)

@LevPewPew · Melbourne, Australia

  
[View profile](https://hashnode.com/@LevPewPew)

Code stuff

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
