Any thoughts on function that will receive one argument and returns back by string representation of the argument in JavaScript?
If the given object implements .toString(), then the function should use it. Otherwise, the function can rely on what the JavaScript implementation offers.
So what I come up with is like this.
var convert = function (arg) {
return (new String(arg)).valueOf();
}