• Wednesday , 29 January 2020

JavaScript Functional Programming Tutorial

Code Canyon



Functional Programming in JavaScript is more like a style, rather than a paradigm. This JavaScript Functional Programming Tutorial was made to demonstrate it’s simply writing your code in a chained, clean and efficient way. Doing this can reduce your 50-100 lines of code to just a few without sacrificing readability and logical integrity.

Relevant keywords, it seems:
functional programming javascript
functional programming vs object oriented
functional patterns
functional programming patterns
functional programming concepts

Follow on Twitter: https://twitter.com/js_tut
Learning Curve Books: http://www.learningcurvebook.net
Instagram: https://www.instagram.com/javascriptteacher
Facebook: https://www.facebook.com/javascriptteacher

Original source

3d Ocean

Related Posts

15 Comments

  1. Nizamuddin Shaikh
    December 10, 2019 at 07:39

    You have shown the very basics of JavaScript functional programming in so simple a way that it clears so many confusions moving around the subject. For any code its conciseness and clarity are of prime important. Thank you for sharing. 😃👍

  2. Benjamin Vincent
    December 10, 2019 at 07:39

    I personally believe that ‘const’ should always be used now to remplace ‘var’ in any case with no exception and in the rare case when you will need to reassign a primitive value which is not passed by reference then in that context it would be the only exception to use ‘let’ instead

  3. Life Simply Rocks
    December 10, 2019 at 07:39

    I don’t think the whole value of Functional programming to save space and reduce number of lines. It should be more than that. For this sole reason I had to dislike the video. 😐

  4. IBrahim Kantaoui
    December 10, 2019 at 07:39

    8:50 please remove the curly brackets { } otherwise, it won't return it, it just won't work 😉

  5. IBrahim Kantaoui
    December 10, 2019 at 07:39

    You've got a new subscriber <3

  6. James Herrero
    December 10, 2019 at 07:39

    @4:49 am i correct in saying that when we are not changing the state unpredictably, by ensuring we have pure functions that do not change this state unpredictably, we are achieving the desired result of functional programming?

  7. Datamike
    December 10, 2019 at 07:39

    The downside is that you can also take this sort of programming too far, producing an endless chain of maps, filters, reducers, and whatever else. Your example is nice and clean because your data is extremely simplify and you're only performing a couple of operations.

    I've seen some horrific balls of spaghetti mess written this way.
    Imo programmers are too obsessed with reducing the lines of code. There is much to be said about breaking the code down to a few extra lines for readability. Less code is not always better.

  8. Zealous Programmer
    December 10, 2019 at 07:39

    Thank you very much! – It is very sad how Ruby is so overlooked Yukihiro Matsumoto already added all these feature in the language that JS and Java and others adopted recently.

  9. Алексей Алексеев
    December 10, 2019 at 07:39

    How can I write this snippet in FP-way?
    if(a) {
    let b = getFrom(a);
    if(b) {
    proceed(b)
    } else {
    done()
    }
    } else {
    done()
    }

  10. imorkutuser
    December 10, 2019 at 07:39

    Your introduction was very perfect….as I was also looking for technical concepts of functional programming than its definition 🙂
    Thanks for your clean and understandable video.

  11. erick garcia
    December 10, 2019 at 07:39

    Is important to highlight that when u write something like this "add = item =>{ item+1 };" is not the same as if u write it like this "add = item => item+1;" because in the first case u are not actually returning anything but in the second way u are returning the new item, so the second way is cleaner but you also implicitly return the new value

  12. katya sorok
    December 10, 2019 at 07:39

    If your array L = [2,3,4] and you calculating var val by applying to L function add_one to each item and than reducing the result by summarizing all items in it, than your val should equal 12. Not 9! Did you start with L=[1,2,3]? or L=[2,3,4]?

  13. klemensas burzujus
    December 10, 2019 at 07:39

    That's a great way to take something so simple as For loop and turn it into unreadable and incomprehensible bunch of functions 😀 Well now i know that i don't like functional programming. But i learned something new and am enjoying your tutorials. Thanks! Keep it up.

  14. Sergio Martín
    December 10, 2019 at 07:39

    An introduction to writing
    elegant, readable and maintainable code.
    Great lesson, as usual. Thank you for your effort.

  15. Naouak Nawak
    December 10, 2019 at 07:39

    This is not an introduction to functionnal programming but just an introduction to map/reduce. Let's stop defining FP as map/reduce/filter, these are just a small part of what FP is.

    Also, an arrow function is not like a function, it is mostly like a function. We need to stop as a community teaching people that arrow functions are the same as regular functions. They have an objective and that's what we need to teach. Knowing how `this` work is important and teaching that when explaining arrow function is important.

Leave A Comment

You must be logged in to post a comment.