---
title: "Discussion on \"Using Loops in JavaScript\" | Hashnode"
description: "Discussion on \"Using Loops in JavaScript\". Iterate over the contents of a String or Array"
url: "https://hashnode.com/posts/using-loops-in-javascript/626bd3b36072cdb96d149b5f"
---

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

Discussion

# [Using Loops in JavaScript](https://ehoversten.hashnode.dev/using-loops-in-javascript?utm_source=hashnode&utm_medium=feed)

Iterate over the contents of a String or Array

Apr 29, 2022 · 7 min read · ehoversten.hashnode.dev  
Read the article

-   [#web-development](https://hashnode.com/tag/web-development)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#newbie](https://hashnode.com/tag/newbie)
-   [#developer](https://hashnode.com/tag/developer)

## Written by

[Erik Hoversten](https://hashnode.com/@Ehoversten)

@Ehoversten · Arlington, VA

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

## Responses 1

Markdown supported · ⌘↵ to post

[TypeC](https://hashnode.com/@typec)

[Apr 29, 2022](https://hashnode.com/posts/using-loops-in-javascript/626bd3b36072cdb96d149b5f/comment/626befc3b7dcabd258e74424)

There's another way to do a loop in Javascript using ES6 syntax.

```
let numberArr = [1, 2, 3, 4, 5];
numberArr.map(number => {
    console.log(number)
})
```
