Javascript - Map function (Functional programming)

1 - About

The functional programming function map in a Javascript context is only an array method as all functional programming javascript method.

For the map data type, see Javascript - Map Data Type

3 - Example

3.1 - Arrow Function

With an Arrow function as argument

  • Letters that we want to lowercase

const letters = ['A', 'B', 'C', 'D', 'E'];

console.log("Showing only the function value call");
const lowercases = => letter.toLowerCase());

  • With the index

console.log("Showing the value, index call");, index) => console.log("Letter at position "+index+" is "+letter.toLowerCase()));

3.2 - Function Declaration

With an Javascript - Function Declaration

  • The function declaration

function double(num) {
    return 2*num;

  • The array of number that we want to double.

const numbers = [1, 2, 3, 4, 5];

// Passing the function name
const doubled =;
// Declaring the function inside the map works also
const doubled2 = double(num) {
    return 2*num;
console.log("doubled data");
console.log("doubled2 data");

4 - Documentation / Reference

Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap