Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

currying in javascript

//Currying:
It is a technique in functional programming, transformation of the 
function of multiple arguments into several functions of a single 
argument in sequence. It is also called nested function is ecmascript

//Without currying
function calculateVolume(length, breadth, height) {
        return length * breadth * height;
    }
//With Currying
function calculateVolume(length) {
        return function (breadth) {
            return function (height) {
                return length * breadth * height;
            }
        }
    }
 
PREVIOUS NEXT
Tagged: #currying #javascript
ADD COMMENT
Topic
Name
5+9 =