Skip to content
FLAVIO COPES
flaviocopes.com
2026

The String valueOf() method

By Flavio Copes

Learn how the JavaScript valueOf() method returns the primitive string value of a String object, working exactly like the toString() method does.

~~~

Returns the string representation of the current String object:

const str = new String('Test')
str.valueOf() //'Test'

Same as toString().

~~~

Related posts about js: