String constructor is used to create a new
String object. When called instead as a function, it performs type
conversion to a "primitive string" which is usually more
String()can be called with or without
new, but with different effects. See Return value.
- : Anything to be converted to a string.
String is called as a constructor (with
new), it creates a
String object, which is not a primitive.
String is called as a function, it coerces the parameter to a string primitive.
Symbol values would be converted to
description is the description of the Symbol, instead of throwing.
Warning: You should rarely find yourself using
Stringas a constructor.