is a leading surrogate), but it is the last code unit in the string, or the next code unit is not a trailing surrogate. There are several ways to achieve nearly the same effect in JavaScript. The resulting primitive is then converted to a string.
Objects are first converted to a primitive by calling its (with 'string' as hint), toString(), and valueOf() methods, in that order.BigInts are converted with the same algorithm as toString(10).Numbers are converted with the same algorithm as toString(10).true turns into 'true' false turns into 'false'.The operation can be summarized as follows: Many built-in operations that expect strings first coerce their arguments to strings (which is largely why String objects behave similarly to string primitives).