I want one of the properties of the passed object to be a pointer to a function. But the function is executed, and I do not want to do this.
This is similar to the fact that instead of passing a reference to a function, you execute the function and pass the return value.
Maybe your source code has
myFunc( {foo:"bar", onDone: myFuncPtr()} );
which calls myFuncPtr and sets the return value to onDone .
The code in the question is good though, just call o.onDone() inside myFunc .
As already mentioned, there are no pointers in JavaScript, it is much simpler. Functions are only data types, such as strings, numbers, arrays, etc. that can be called.
source share