In this challenge, the goal is to incorporate a JavaScript function as a callback to display progress during a while-loop operation. For example:
var my_js_fn = function(curstate, maxstate){//int variables
console.log(curstate.toString() + " of " + maxstate.toString());
}
Here is the C pseudocode:
int smth_that_calls_my_fn(int i, int max) {
/*
the_magic to call my_js_fn()
*/
}
int main(){
//....
while (i < max){
smth_that_calls_my_fn(i,max);
}
//....
return 0;
}
The question at hand is how to establish a connection between smth_that_calls_my_fn
and my_js_fn
?