<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/map-method-explained-js-uxlxqyj-a" -->

---
title: map() method explained : JS | daily.dev
description: The map() method is used to apply a function on every element in an array and then return a new array. You can use the current value, current index or even the...
canonical: https://daily.dev/posts/map-method-explained-js-uxlxqyj-a
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: map() method explained : JS | daily.dev
og:description: The map() method is used to apply a function on every element in an array and then return a new array. You can use the current value, current index or even the...
og:url: https://daily.dev/posts/map-method-explained-js-uxlxqyj-a
og:image: https://api.daily.dev/og/posts/Uxlxqyj-a.png
og:image:alt: map() method explained : JS
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# map() method explained : JS

**[DZone](https://daily.dev/sources/dz)** · [@rahxul](https://daily.dev/rahxul) · 2 min read · 77 upvotes · 2 comments

## Summary

The map() method is used to apply a function on every element in an array and then return a new array. You can use the current value, current index or even the entire array to determine what to return. The filter() method can be thought of as a for loop, that is specifically for transforming values.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://rahulism.hashnode.dev/map-method-explained-js>

## Community discussion

Top comments from developers on daily.dev.

**@anandbit** · 2 upvotes

> Minimal but good explanation of what was given on MDN

**@neeraj1005** · 1 upvotes

> nice explanation +1

---

Tags: [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/map-method-explained-js-uxlxqyj-a)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"map() method explained : JS","url":"https://daily.dev/posts/map-method-explained-js-uxlxqyj-a","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/map-method-explained-js-uxlxqyj-a"},"datePublished":"2021-09-01T11:15:55.691Z","dateModified":"2021-10-07T14:17:10.317Z","description":"The map() method is used to apply a function on every element in an array and then return a new array. You can use the current value, current index or even the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/17d015be5777911f1814fbfd501c17d1","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/17d015be5777911f1814fbfd501c17d1","isAccessibleForFree":true,"articleSection":"DZone","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Rahul","url":"https://daily.dev/rahxul","image":"https://media.daily.dev/image/upload/s--w_EB7y0c--/f_auto,q_auto/v1/avatars/avatar_UA2asvbfX","description":"Hustler","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":2120}},"commentCount":2,"discussionUrl":"https://daily.dev/posts/map-method-explained-js-uxlxqyj-a","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":77},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"keywords":"javascript","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"DZone","item":"https://daily.dev/sources/dz"},{"@type":"ListItem","position":3,"name":"map() method explained : JS"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/map-method-explained-js-uxlxqyj-a","comment":[{"@type":"Comment","text":"Minimal but good explanation of what was given on MDN","datePublished":"2021-09-01T17:45:52.620Z","url":"https://daily.dev/posts/Uxlxqyj-a#c-2qMRFBOVD","author":{"@type":"Person","name":"Anand Kumar","url":"https://daily.dev/anandbit","image":"https://avatars.githubusercontent.com/u/56770818?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"nice explanation +1","datePublished":"2021-09-01T14:30:21.488Z","url":"https://daily.dev/posts/Uxlxqyj-a#c-u_6Y5eLNn","author":{"@type":"Person","name":"Neeraj Singh Tangariya","url":"https://daily.dev/neeraj1005","image":"https://lh3.googleusercontent.com/a-/AOh14GjX9wb8Rxn2w3QhkBxwR465ZOzsMUAYCuqGnUwwrQ=s100"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}]}
```

