TypeScript Array toString() Method

The Array.toString() is an inbuilt TypeScript function that is used to get a string representing the source code of the specified array and its elements.
Syntax:
array.toString()
Parameter: This method does not accept any parameter.
Return Value: This method returns the string representing the array.
Below example illustrate the String toString() method in TypeScriptJS:
Example 1:
JavaScript
| <script>    // Driver code    vararr = [ 11, 89, 23, 7, 98 ];     // use of toString() method     varstring= arr.toString();             // printing    console.log(string);</script> | 
Output:
11,89,23,7,98
Example 2:
JavaScript
| <script>    // Driver code    vararr = ["G", "e", "e", "k", "s", "f", "o",                "r", "g", "e", "e", "k", "s"];     varval;     // use of toString() method     val = arr.toString();    console.log( val );</script> | 
Output:
G,e,e,k,s,f,o,r,g,e,e,k,s
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
 
				 
					


