Advertisement
728x90
A thunk is just a function which delays the evaluation of the value. It doesn’t take any arguments but gives the value whenever you invoke the thunk. i.e, It is used not to execute now but it will be sometime in the future. Let's take a synchronous example,
javascript
1const add = (x, y) => x + y;
2
3const thunk = () => add(2, 3);
4
5thunk(); // 5Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 11
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
354of476