I have this:
this.f = function instance(){};
I would like to have this:
this.f = function ["instance:" + a](){};
As others mentioned, this is not the fastest nor most recommended solution. Marcosc's solution below is the way to go.
You can use eval:
var code = "this.f = function " + instance + "() {...}";
eval(code);