JavaScript Object valueOf() Method
- Προηγούμενη σελίδα toString()
- Επόμενη σελίδα values()
- Επιστροφή στο προηγούμενο επίπεδο Εγχειρίδιο οντοτήτων JavaScript
Definition and usage
valueOf()
the method returns the original value of the object.
If an object does not have an original value, then valueOf()
Returns the object itself.
valueOf()
The method does not change the original object.
Note:fruits.valueOf()
Returns the same as fruits
The same value.
Instance
Example 1
Get the value of fruits:
const fruits = ["Banana", "Orange", "Apple", "Mango"]; const myArray = fruits.valueOf();
Example 2
The return value of fruits.valueOf() is the same as fruits:
const fruits = ["Banana", "Orange", "Apple", "Mango"]; const myArray = fruits;
Syntax
object.valueOf()
Parameter
No parameters.
Return value
Type | Description |
---|---|
Object |
The original value of an object. If an object does not have an original value, the valueOf() returns the object itself. |
Browser support
valueOf()
It is an ECMAScript1 (ES1) feature.
All modern browsers support ES1 (JavaScript 1997):
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Υποστήριξη | Υποστήριξη | Υποστήριξη | Υποστήριξη | Υποστήριξη | Υποστήριξη |
Σχετικές σελίδες
- Προηγούμενη σελίδα toString()
- Επόμενη σελίδα values()
- Επιστροφή στο προηγούμενο επίπεδο Εγχειρίδιο οντοτήτων JavaScript