Curriculum Series

What is a thunk?

What is a thunk?

What is a thunk?

JavaScript

Thunk

A thunk is a function that has everything already that it needs to do to give you some value back. You do not need to pass any arguments in, you simply call it and it will give you a value back.

javascript
function add(x, y) {
return x + y;
}
var thunk = function () {
return add(10, 15); // 25
};
thunk();

Finished reading?

Mark this topic as solved to track your progress.