---
title: "Discussion on \"forEach() vs map() in JavaScript\" | Hashnode"
description: "Discussion on \"forEach() vs map() in JavaScript\". Map() function\nIn JavaScript, the map function is a higher-order function that is used to create a new array by applying a provided function to each element of an existing array. The original array remains unchanged. The map function takes a callback..."
url: "https://hashnode.com/posts/foreach-vs-map-in-javascript/65a69b4ad49fb70b32ad764a"
---

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

Discussion

# [forEach() vs map() in JavaScript](https://codewithsharma.hashnode.dev/foreach-vs-map-in-javascript?utm_source=hashnode&utm_medium=feed)

Map() function In JavaScript, the map function is a higher-order function that is used to create a new array by applying a provided function to each element of an existing array. The original array remains unchanged. The map function takes a callback...

Jan 16, 2024 · 2 min read · codewithsharma.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#webdev](https://hashnode.com/tag/webdev)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#array-methods](https://hashnode.com/tag/array-methods)
-   [#array](https://hashnode.com/tag/array)

## Written by

[Dev Raj Sharma](https://hashnode.com/@codewithsharma)

@codewithsharma · Jalandhar, India

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

MERN Stack developer from India.

I am Dev Raj Sharma, a dedicated MERN Stack Developer from India. Currently immersed in the world of MERN stack development, I am also pursuing my MCA at PTU University. Passionate about coding and staying updated with the latest technologies, I am on a continuous journey of learning and growth in the field of web development.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
