C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
| JavaScript String valueOf() MethodThe JavaScript string valueOf() method is used to find out the primitive value of String object. This method is invoked by JavaScript automatically. Thus, there is no requirement to call it explicitly in the code. Syntax
 The valueOf() method is represented by the following syntax: string.valueOf() Returns
 A string representing the primitive value of string object. JavaScript String valueOf() Method Example
 Let's see some simple examples of valueOf() method. Example 1Here, we will print the primitive value of string object. <script> var str="TheDeveloperBlog"; document.writeln(str.valueOf()); </script> Output: TheDeveloperBlog Example 2Let's see one more example to print the primitive value of string object. 
<script>
var str=new String("TheDeveloperBlog");
document.writeln(str.valueOf());
</script>
Output: TheDeveloperBlog 
Next TopicJavaScript String
 |