Wrapper type.typeof wrapped is "object", not "string".
After valueOf. The result is a primitive → typeof is "string".
Value match. That primitive equals "Hi" with ===.
Rule of thumb. Prefer literals so you rarely need this unwrap step.
Compatibility
Browser & Runtime Support
String.prototype.valueOf() is a long-standing core method — available in all modern browsers and every supported Node.js release.
✓ Baseline · Widely available
String.prototype.valueOf()
Supported everywhere JavaScript runs. Safe for all targets; no polyfill needed for modern or legacy browsers that still matter.
100%Universal support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
valueOf()Universal
Bottom line: Use freely when you need the primitive string. Prefer literals day to day, and use String(value) when converting non-string types.
Frequently Asked Questions
valueOf() returns the primitive string value — the text itself for a literal, or the string wrapped by a String object. It takes no arguments and does not change the original value.
For String, they are equivalent — same result. Either can unwrap a String object to a primitive string.
Usually no. JavaScript often calls valueOf internally during coercion. You may call it explicitly to document that you want the primitive string.
Calling String.prototype.valueOf with a non-string this (for example via call on a number) throws TypeError. It does not coerce other types to string.
Use String(value) (or a template literal) when you need to convert any type to a string. valueOf only works on string primitives or String objects.
Prefer string literals ("text") over new String("text"). Wrappers are rarely needed; valueOf mainly helps you understand and unwrap them.