Friday, June 22, 2012

valueOf()

Metode String.valueOf() mengembalikan string primitive version dari objek String.

Sintaks:

stringObj.valueOf()

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

Contoh:

var stringObj = new String("Halo!"); document.write(stringObj.valueOf()); // "Halo!"