In JavaScript, which types support toString()? -
the good:
'hello'.tostring() // "hello" let obj = {} obj.tostring() // "[object object]"
the bad:
undefined.tostring() // throws typeerror null.tostring() // throws typeerror
are there other types throw on .tostring() method? thanks
every obj inherited object has string method.
starting javascript starting in javascript 1.8.5 tostring() called on null returns [object null], and undefined returns [objectundefined].
you can read more @ link: you can read more @ link
Comments
Post a Comment