I am trying to alert a returned value from a function and I get this in the alert:
[object Object]
Here is the JavaScript code:
[object Object]
is the default string representation of a JavaScript Object
. It is what you'll get if you run this code:
alert({}); // [object Object]
You can change the default representation by overriding the toString
method like so:
var o = {toString: function(){ return "foo" }};
alert(o); // foo