Most articles make it sound like return.
Essentially what I want to do is run Callback functions on my Server to ensure max speed of the processes.
setTimeout and setInterval can be troublesome. And after asking on StackOverflow, they referred me to callback.
I would like a brief explanation perhaps.
Or tell me if I am right in that callback basically runs as fast as it can. Keeping in mind that JavaScript is event-based and asynchronous.
Here is a piece of JavaScript that is not working, perhaps someone can fix it and explain my error.
function test(callback)
{
if (cubePos < 5)
{
cube.position.x = cube.position.x + 0.1;
cubePos = cube.position.x;
}
else
{
cube.position.x = - 5;
cubePos = cube.position.x;
}
callback.call(test());
};
It looks like I am calling the function within itself. But I don't know how it is supposed to look with callback.













