Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

JavaScript Array valueOf() Method

  • Last Updated : 25 Jun, 2020

Below is the example of Array valueOf() method.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

  • Example:

    function func() { 
        // Original array 
        var array = ["GFG", "Geeks", "for", "Geeks"]; 
        // Checking for condition in array 
        var value = array.valueOf(); 
  • Output:

The arr.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.



Parameters: This method does not accept any parameter.

Return Value: It returns an Array.

Below examples illustrate the JavaScript Array valueOf() method:

  • Example:
    var array = ["DS", "Algo", "PHP", "JS", "OS"]; 
    var value = array.valueOf(); 



Example codes for the above method are as follows:

<!DOCTYPE html>
        JavaScript Array valueOf() Method
<body style="text-align:center;">
    <h1 style="color:green"
    <h2>JavaScript Array valueOf() Method</h2>
    <button onclick="myGeeks()">Click me</button>
    <p id="sudo" style="font-size:20px;"></p>
        function myGeeks() {
            var sub = ["DS", "Algo", "PHP", "JS", "OS"];
                    = sub.valueOf();


Supported Browsers: The browsers supported by JavaScript Array valueOf() Method are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

My Personal Notes arrow_drop_up
Recommended Articles
Page :