Latest web development tutorials

JavaScript valueOf () method

Array Object Reference Manual JavaScript Array Object

Examples

valueOf () is the default method of an array of objects.

var fruits = ["Banana", "Orange", "Apple", "Mango"];
var v=fruits.valueOf();

fruits.valueOf () Returns the value of the same fruits.

v The output is:

Banana,Orange,Apple,Mango

try it"


Definition and Usage

valueOf () method returns an Array object's original value.

All objects in the original value derived by the Array object inheritance.

valueOf () method is usually called automatically by JavaScript in the background and does not appear explicitly in the code.

Note: valueOf () method does not change the original array.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support valueOf ().


grammar

array.valueOf()

return value

Type 描述
Array valueOf() 返回数组值


Array Object Reference Manual JavaScript Array Object