Map – Part 2 of Functional Programming in JavaScript




In this video series, we learn how to do functional programming in JavaScript. In this second one, I show you how and when to use the higher-order function map, and why it is the best thing ever.
Resources:

Code from the video
https://gist.github.com/mpj/c5ae804e576042b3287d

How to install and use io.js (for the arrow functions example)

ES6 in io.js



Original source


36 responses to “Map – Part 2 of Functional Programming in JavaScript”

  1. I am sorry if someone already asked or I totally miss understood the topic, but I believe the map function loops inside itself, so what the buzz about "map", it is just an extension. But the final code that executed would always be the same or more in this case.

  2. var animals = [
    { name: 'Fluffykins', species: 'rabbit' },
    { name: 'Caro', species: 'dog' },
    { name: 'Hamilton', species: 'dog' },
    { name: 'Harold', species: 'fish' },
    { name: 'Ursula', species: 'cat' },
    { name: 'Jimmy', species: 'fish' }
    ]

  3. I really really like your stuff. I always imagined myself doing something very similar to how you do it however fear struck me and I forgot to let myself be crazy like I like to be. Thanks for filling in some gaps that I have.
    On the other hand, I'd like to return you a favor and let you know that:
    CTRL + J (on a selection of multiple lines) will convert them in one line separated by space, more like:
    lines.join(' ');
    Thanks again! You're really cool.

  4. Thank you for making these videos!!!!!! You truly have a gift for communicating potentially tricky concepts with such clarity. I will continue to use your videos throughout my coding journey (which began in December 2016). Thanks again!

Leave a Reply