A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript-array-valueof-method/ below:

JavaScript Array valueOf() Method - GeeksforGeeks

JavaScript Array valueOf() Method

Last Updated : 12 Jul, 2025

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. 

Syntax:

array.valueOf()

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.

JavaScript
function func() {

    // Original array
    let array = ["GFG", "Geeks", "for", "Geeks"];

    // Checking for condition in array
    let value = array.valueOf();
    console.log(value);
}
func();

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

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

JavaScript
const sub = ["DS", "Algo", 
           "PHP", "JS", "OS"];
console.log(sub.valueOf());

Output
[ '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:

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.



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4