JavaScript Array valueOf()
Examples
Get the value of fruits:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
const myArray = fruits.valueOf();
Try it Yourself »
fruits.valueOf()
returns the same as fruits:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
const myArray = fruits;
Try it Yourself »
Definition and Usage
The valueOf()
method returns the array itself.
The valueOf()
method does not change the original array.
fruits.valueOf()
returns the same as fruits
.
Syntax
array.valueOf()
Parameters
NONE |
Return Value
Type | Description |
An array | The valueOf() method returns itself! |
Browser Support
valueOf()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
❮ JavaScript Array Reference