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 »
The valueOf()
method returns the primitive value of an object.
If the object has no primitive value, valueOf()
returns the object itself.
The valueOf()
method does not change the original object.
fruits.valueOf()
returns the same as fruits
.
object.valueOf()
NONE |
The primitive value of an object. If the object has no primitive value, valueOf() returns the object itself. |
valueOf()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!