What is a thunk?

JavaScriptDEShaw

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.

function add(x, y) {
return x + y;
}

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

thunk();
00:00

Table of Contents