Search w3schools.com:

SHARE THIS PAGE

JavaScript valueOf() Method

Array Object Reference JavaScript Array Object

Example

valueOf() is the default method of the array object.

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

 fruits.valueOf() will return the same as fruits

The result of v will be:

Banana,Orange,Apple,Mango

Try it yourself »


Definition and Usage

The valueOf() method returns the array.

This method is the default method of the array object. Array.valueOf() will return the same as Array

Note: This method will not change the original array.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The valueOf() method is supported in all major browsers.


Syntax

array.valueOf()

Return Value

Type Description
Array The valueOf() method returns itself


Array Object Reference JavaScript Array Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]