TUTORIAL · STEP 6 OF 7
Callbacks
A function pointer parameter takes a JavaScript function, and C++ calls it like any other.
countdown calls its Visitor once for every number, and each call runs the arrow function from main.js. applyTwice uses what its Transform returns.
Each JavaScript function handed to C++ holds a slot in the module until Module.releaseCallback(fn) frees it, so release a function once C++ no longer needs it.
Try it
Pass applyTwice a function that squares its argument and check the result.