We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

valueOf Redirect 3

Summary

The valueOf() method returns the primitive value of a String object.

Syntax

str.valueOf()

Description

The valueOf method of String returns the primitive value of a String object as a string data type. This value is equivalent to String.prototype.toString().

This method is usually called internally by JavaScript and not explicitly in code.

Examples

Example: Using valueOf

x = new String("Hello world");
alert(x.valueOf())          // Displays "Hello world"

Specifications

Specification Status Comment
ECMAScript 1st Edition. Standard Initial definition.
Implemented in JavaScript 1.1
ECMAScript Language Specification 5.1th Edition (ECMA-262) Standard  
ECMAScript Language Specification 6th Edition (ECMA-262) Draft  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)

See also

Document Tags and Contributors

Last updated by: Sheppy,