Open In App
Related Articles

TypeScript String toString() Method

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

The toString() is an inbuilt function in TypeScript which is used to return a string representing the specified object.

Syntax: 

string.toString( ) 

Parameter: This methods does not accept any parameter. 
Return Value: This method returns the string representing the specified object. 
Below examples illustrate the String toString() method in TypeScript

Example 1: 

JavaScript

<script>
    // Original strings
    var str = "Geeksforgeeks - Best Platform"
  
    // use of String toString() Method
    var newstr = str.toString() 
    console.log(newstr);
</script>

                    

Output: 

Geeksforgeeks - Best Platform

Example 2: 

JavaScript

<script>
    // Original strings
    var str = "TypeScript - String toString()"
  
    // use of String toString() Method
    var newstr = str.toString() 
    console.log(newstr);
</script>

                    

Output: 

TypeScript - String toString()

Last Updated : 03 Jan, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads