JavaScript String toString() Method Last Updated : 11 Jul, 2025 Comments Improve Suggest changes 3 Likes Like Report The toString() method in JavaScript converts a string object to a string primitive. It returns a string representing the specified object. This method is automatically called when a string object needs to be defined as a text value or concatenated with another string. The toString() method also converts a number to a string.Syntax:string.toString()Parameters: It does not accept any parameter.Return Values: It returns a new string representing the given string object.Example 1: This example shows the basic use of the string.toString() Method in Javascript. javascript // Take string as input and display it // with the help of string.toString() // Method let a = new String("GfG"); console.log(a.toString()); OutputGfG Example 2: Taking a string as input and printing it with the help of a string.toString() method. javascript // Taking a string as input and printing it // with the help of string.toString() method let a = new String("GeeksforGeeks"); console.log(a.toString()); OutputGeeksforGeeks Example 3: Taking a string as input and printing it with the help of string.toString() method. javascript // Taking a string as input and printing it // with the help of string.toString() method let a = new String("GFGGFG"); console.log(a.toString()); OutputGFGGFG Example 4: In this example, we are converts the variable number to a string using the toString() method and output the result. The typeof operator confirms the type of our output as "string". JavaScript let number = 42; let result = number.toString(); console.log(result); console.log(typeof(result)); Output42 string We have a complete list of Javascript string methods, to check those please go through this Javascript String Complete reference article.Supported Browsers: Google Chrome 3Microsoft Edge 12Mozilla Firefox 3.0Safari 5Opera 10.5 Comment K Kanchan_Ray Follow 3 Improve K Kanchan_Ray Follow 3 Improve Article Tags : JavaScript Web Technologies javascript-string JavaScript-Methods Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)8 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like