Let' s create our array

const n = [2, 4, 6, 8, 10];

    map method requires callback function
    that will be ran agains every element
    in the provided array. 
    There are two ways to specify callback
    function. First, we can specify it inside
    map method itself, or we can create separate 
    function and provide this function to map

//Provide function inside map method

    We create variable r that will hold 
    returned array. Then we run map
    against const n. Our callback function
    is simple arrow function that multiplies 
    every item from const n by 2.

const r = => item * 2);

//Output: [4, 8, 12, 16, 20]

//Create separate function and pass it to map

    Second example does the same as first.
    Difference is that in second example we provide
    separate function and pass it to map.
    This is better way in terms that you can reuse
    function on multiple places

const s =;

function multiply(item) {
    return item * 2;

//Output: [4, 8, 12, 16, 20]