Skip to content
Related Articles
Open in App
Not now

Related Articles

JavaScript Array valueOf() Method

Improve Article
Save Article
  • Last Updated : 14 Dec, 2022
Improve Article
Save Article

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



Parameters: This method does not accept any parameter. 

Return Value: It returns an Array. 

Below examples illustrate the JavaScript Array valueOf() Method:

Example 1: In this example, we will see the basic use of the Array valueOf() method.


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



Example 2: 


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



We have a complete list of Javascript Array methods, to check those please go through this Javascript Array Complete reference article.

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

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

We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript.

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!