View Full Version : simple enumeration question

08-19-2008, 05:54 AM
According to JavaScript: The Good Parts, "The for in statement can loop over all of the property names in an object. The enumeration will include all of the properties—including functions and prototype properties", but when I try:

var x;
var mystr = new String("abc");
for (x in mystr) {
document.writeln(x + ':' + mystr[x] + "<br/>");

in IE I get nothing output at all and in FF2 I get 0:a 1:b 2:c -but no functions. I was wondering why all the properties of the String object e.g. chartAt() and indexOf() etc. aren't displayed?


08-19-2008, 06:16 AM
Many built-in properties do not enumerate.

08-20-2008, 01:20 AM
thanks :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum