JavaScript String valueOf() method by The JavaScript string valueOf() method returns the primitive value of a string object. Syntax: string.valueOf() Example: <!DOCTYPE html> <html> <body> <script> var a ="Hello World!"; document.write(a.valueOf()); </script> </body> </html>