I have an object with the following structure
var obj = {
toString: function(){ return "20" },
valueOf: function(){ return 10; }
};
alert(obj) //20
console.log(obj) //Object {toString: function, valueOf: function}
unlike alert(obj) why console.log(obj) shows object structure instead of return value of toString()??
In both scenario expecting string text.