This is the explicit use of the native constructor function that creates and returns a string object when used with the new
operator or the string value only when used without new
.
This invokes the object's toString()
method which returns the string representation of the object, which, if not overridden, usually is something like [object Object]
, which indicates the instance and the type. Custom objects often will override this inherited method to be able to display the best string representation of that particular object.
This takes an object and converts it into the JSON data format. Without using an optional "replacer" function, all properties that store functions will be stripped out of the string. This is generally used when an object is packaged to hold data and then that data is to be sent over HTTP to another location.