JavaScript | Array valueOf() Method
The Array valueOf() Method in JavaScript is used to return the array. It is a default method of the Array Object. This method returns all the items in the same array. It will not change the original content of the array. It does not contain any parameter values.
Syntax:
array.valueOf()
Return Value: It returns an Array.
Example:
<!DOCTYPE html> <html> <head> <title> JavaScript Array valueOf() Method </title> </head> <body style="text-align:center;"> <h1 style="color:green"> GeeksforGeeks </h1> <h2>JavaScript Array valueOf() Method</h2> <button onclick="myGeeks()">Click me</button> <p id="sudo" style="font-size:20px;"></p> <script> function myGeeks() { var sub = ["DS", "Algo", "PHP", "JS", "OS"]; document.getElementById("sudo").innerHTML = sub.valueOf(); } </script> </body> </html> |
- Before Clicking on Button:

- After Clicking on Button:

Supported Browsers: The browsers supported by JavaScript Array valueOf() Method are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Safari
- Opera
Recommended Posts:
- Number valueOf( ) Method In JavaScript
- JavaScript | string.valueOf()
- JavaScript | symbol.valueOf() function
- JavaScript | date.valueOf() function
- JavaScript | boolean.valueOf() function
- JavaScript | Array from() Method
- JavaScript | Array map() Method
- JavaScript | Array.from() method
- JavaScript | Array.findIndex() Method
- JavaScript | Array.find() Method
- JavaScript | Array.fill() Method
- JavaScript | Array reduce() Method
- JavaScript | Array.join() Method
- JavaScript | Array.splice() Method
- JavaScript | array.entries() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




