The valueOf() Function is used to return the Array as is.
Let us say we have the below array with four elements.
var x = [5, 8, 2, 9]
<html> <body> <script> var x = [5, 8, 2, 9] var y = x.valueOf() document.write(y) </script> </body> </html>
So, in the above code we have array that has 4 numbers.
var x = [5, 8, 2, 9]
And we want to display the values of the Arrays as is.
So we have used the valueOf() function to display the array as is.
var y = x.valueOf()