Monday, June 18, 2012

valueOf()

Metode Array.valueOf() mengembalikan nilai primitif dari objek Array.

Sintaks:

arrayObj.valueOf()

Metode Array.valueOf() adalah metode standard JavaScript 1.1+, JScript 2.0+, ECMAScript 1.0+ dan di dukung oleh Google Chrome Beta+, Firefox 1.0 (Gecko 1.7)+, Internet Explorer 4.0+, Netscape Navigator 3.0+, Opera 4.0+, Safari 1.0+.

Contoh:

var arr = new Array(); arr[0] = "e0"; arr[1] = "e1"; arr[2] = "e2"; arr[3] = "e3"; arr[4] = "e4"; arr[5] = "e5"; document.write(arr.valueOf()); // e0,e1,e2,e3,e4,e5