currying : javascript interview question

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” text_text_color=”#000000″ use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

Currying is a useful technique, with which you can partially evaluate functions.

 

One of the most basic example of the currying is shown below.

 

As currying is not a native to javascript, we will have to write our own. We can write one function which can convert any function into the curried function as shown below.

 

Now, let’s update our first example.

 

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons