Open In App
Related Articles

JavaScript Array valueOf() Method

Improve Article
Save Article
Like 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. 

The 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
    let array = ["GFG", "Geeks", "for", "Geeks"];
    // Checking for condition in array
    let value = array.valueOf();


[ 'GFG', 'Geeks', 'for', 'Geeks' ]

Example 2: In this example, we will show the use of valueOf method.


const sub = ["DS", "Algo",
           "PHP", "JS", "OS"];


[ 'DS', 'Algo', 'PHP', 'JS', 'OS' ]

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.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 13 Jul, 2023
Like Article
Save Article
Similar Reads
Related Tutorials