Returns the value, coerced to a string.
This typically calls the object’s toString
method, but with some special cases:
- If the
value
is anArrayBuffer
(e.g., returned from a web request) orTypedArray
, then this call decodes the value as UTF-8 text. - If the object’s underlying
toString
method is the degenerate implementation ofObject.toString()
(which normally returns the text “[object Object]”), this method returnsnull
instead. The principle is that it’s better for this method to essentially fail than for it to return a useless string.