javascript - What is the purpose of Object.prototype.toString()? -


i see code in underscore.js.

here is, alias applied:

tostring = objproto.tostring, 

however, use tostring accessible directly this, w/ out using above code @ all.

tostring() 

try out in console works fine. try out in direct code , works fine well. guess older browsers may not have accessible in way.

how can further?

caniuse not not have information on it.

google pulls nothing useful in first 10 or hits.

because on object.prototype, accessible global objects inherit object ( inherit, not global objects ), such number.

but point is, is accessible directly out having use global object instance @ all.

tostring(some_var); 

here 1 so q/a suggests window.tostring not supported in browsers , why is.

global objects inherit object,

that's wrong assumption, global objects host objects , can inherit whatever want or not inherit @ all. code example doesn't work in ie10.

the particular tostring method stored on object.prototype 1 returns internal class name sure. functions, arrays, numbers etc not inherit object.prototype tostring method define own tostring method, in number.prototype.tostring !== object.prototype.tostring.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

colors - Anyway to make the uBaseColor value transparent? Three.js && ShaderToon.js -