Using JavaScript's built-in objects
Briefly

Using JavaScript's built-in objects
"The toString() method is very simple. You can call it on anything, and if nothing has been defined, it'll use the default version. Many objects, like arrays, do define their own version. Custom objects can also define a version. When you interpolate an object into a string literal- console.log("This is my object: " + myObject)-it will call the toString() method."
"Of all of JavaScript's built-in objects, JSON may be the most commonly used. It lets you transform between string JSON and live JSON objects. (For more about JavaScript Object Notation, see InfoWorld's primer, What is JSON?.) The JSON object is useful all the time. Here's an example that might be familiar: let stringJson = '{"nums": [1,2,3,4]}'; console.log(JSON.parse(stringJson).nums[0]); // outputs "1" let jsonObject = {"letters": [a,b,c,d]}; console.log(JSON.stringify(jsonObject)); // outputs "{"letters": [a,b,c,d]}""
JavaScript includes built-in objects such as Object, JSON, console, String, Math, Date, window, and global that form the core programming environment in browsers and Node. Object serves as the root prototype and provides methods like toString() and Object.assign(), with toString() used during string interpolation and assign() performing shallow cloning that preserves references for nested properties. JSON enables conversion between string JSON and live objects via JSON.parse() and JSON.stringify(), commonly used for data interchange. Other built-ins supply utility functions for logging, string manipulation, mathematical operations, and date handling across platforms.
Read at InfoWorld
Unable to calculate read time
[
|
]