Subj : Re: Array and [ ] To : netscape.public.mozilla.jseng From : =?ISO-8859-1?Q?Georg_Maa=DF?= Date : Sat Jan 22 2005 07:52 pm Igor Bukanov wrote: > But this is a useful violation since I spend some time > trying to figure out why a script did not work properly only to find out > that [] was called inside "with (objectWithArrayProperty)". > Is this such a sample (untested): function Array() { var r = [].constructor.apply(Array.arguments); for(var i in r)if(typeof r[i] == 'string') r[i] = r[i].toLowerCase(); return r; } a = new Array('A','B'); alert('lower case now...\n\na[0]: '+a[0]+'\na[1]: '+a[1]); and the more complex standard like implementation (tested): var A = Array; Array = function() { var r = Array.$__Array.apply(this, Array.arguments); for(var i in r)if(typeof r[i] == 'string') r[i] = r[i].toLowerCase(); Array = Array.$__Array; return r; } Array.$__Array = A; a = new Array('A','B'); alert('lower case now...\n\na[0]: '+a[0]+'\na[1]: '+a[1]); -- Georg Maaß - bioshop.de D-76227 Karlsruhe, Westmarkstraße 82 HTML, XML / JavaScript, C++, Java, PHP, VB / CGI, JSP, ASP, ASP.net - The ultimate DHTML engine: http://gml-modul.sourceforge.net - http://sourceforge.net/projects/gml-modul .