Tutorialspoint.dev

JavaScript | string.valueOf()

The string.valueOf() is an inbuilt function in JavaScript which is used to return the value of the given string.
Syntax:

string.valueOf()

Parameters: It does not accept any parameter.
Return Values: It returns a string which represent the value of the given string object.

JavaScript code to show the working of string.valueOf() function:

<script>
  
    // Taking a string as input and printing it
    // with the help of string.valueOf() function
    var a = new String("GeeksforGeeks");
    document.write(a.valueOf());
  
</script>

Output:

GeeksforGeeks


This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment

code

0 Comments

load comments

Subscribe to Our Newsletter