JavaScript valueOf () method
Definition and Usage
valueOf () method returns the original value of the String object.
Note: valueOf () method is usually called by the JavaScript automatically in the background, rather than explicit in the code.
grammar
string.valueOf()
Browser Support
All major browsers support valueOf () method
Examples
Examples
Returns a String object's original value:
<script>
var str="Hello world!";
document.write(str.valueOf());
</script>
var str="Hello world!";
document.write(str.valueOf());
</script>
Examples of the above output:
Hello world!
try it"
JavaScript String Object