Understand currization

Currying is a technique that converts a function that takes multiple arguments into a function that takes a single argument (the first argument of the original function), and returns a new function that takes the remaining arguments and returns a result.

Conclusion: it is the function of multi-parameter function to use high-order function to return a function to deal with a single function

Code sample

    // This is a Currified function
    function currying(val){
        console.log(val)
        return function(txt){
            console.log(txt)
        }
    }
    
    currying('test') 
    // test
    currying('test') ('lala') 
    // test
    // lala
Copy the code

Conclusion: The code above shows the advantage of using only currying() when I only want to output val