i'm noob of javascript , i'm confused what's difference following methods.
function foo(){}; var bar = new object(); object.prototype.tostring.call(foo).slice(8, -1); // output "function" typeof foo; // output "function" object.prototype.tostring.call(bar).slice(8, -1); // output "object" typeof bar; // output "object"
you can't override gets returned typeof
var myobject = function() { }; myobject.prototype.tostring = function() { return undefined; } var x = new myobject(); console.log(typeof x); console.log(x.tostring()); if you're interested in javascript`s methods, check out mdn:
Comments
Post a Comment