7.1.17 ToString ( argument )
The abstract operation ToString takes argument argument (an ECMAScript language value) and returns either a normal completion containing a String or a throw completion. It converts argument to a value of type String. It performs the following steps when called:
- If argument is a String, return argument.
- If argument is a Symbol, throw a TypeError exception.
- If argument is undefined, return "undefined".
- If argument is null, return "null".
- If argument is true, return "true".
- If argument is false, return "false".
- If argument is a Number, return Number::toString(argument, 10).
- If argument is a BigInt, return BigInt::toString(argument, 10).
- Assert: argument is an Object.
- Let primValue be ? ToPrimitive(argument, string).
- Assert: primValue is not an Object.
- Return ? ToString(primValue).