Well, I would say yes, since you are using V8.
What the String contatenation is really doing behind the scenes, is to invoke the Function.prototype.toString
method, for example:
var str = "" + f;
Is roughly equivalent to:
var str = f.toString();
This method provides an implementation-dependent string representation of the function, it can vary between implementations, for example whitespace, or optimizations can me done.
But since you are targeting an specific implementations I think you won't have any problem.
If you are getting "[object Function]"
it's because (oddly) the Object.prototype.toString
is being executed instead the Function.prototype.toString
one, e.g.:
Object.prototype.toString.call(function () {}); // "[object Function]"