Subj : Re: uneval To : netscape.public.mozilla.jseng,de.comp.lang.javascript From : =?ISO-8859-1?Q?Georg_Maa=DF?= Date : Fri Apr 25 2003 08:08 pm Dietmar Meier wrote: > Georg Maaß wrote: > > >>What does the global function uneval do? I know, what eval does, but >>what does uneval? Where can I find documentation about that function? >>The function resides inside Mozilla and the shell as well. So it seems >>to be part of the language and not part of the host. > > > I didn't find any documentation neither, but I found out that you might > use uneval for serialization of objects and arrays. Here's an example: > > var a = new Object; > a.foo = 3; > a. bar = 42; > alert(uneval(a)); > > var b = new Array(); > for (var i=0; i<3; i++) { > b[i] = new Array(); > for (var j=0; j<2; j++) { > b[i][j] = new Array(); > for (var k=0; k<4; k++) > b[i][j][k] = Math.floor(Math.random() * 42); > } > } > alert(uneval(b)); > > > f'up2 dcljs gesetzt, da ich npmj nicht lese. > > ciao, dhgm > js> b.toSource(); [[[15, 0, 15, 26], [23, 14, 31, 4]], [[5, 3, 17, 9], [8, 36, 29, 9]], [[10, 24, 28, 32], [31, 16, 23, 9]]] js> typeof uneval(b); string js> b.toSource=function(){return 'test'}; function () { return "test"; } js> b.toSource(); test js> uneval(b); test As you see, it simply calls the toSource method. -- Georg Maaß - bioshop.de D-93466 Chamerau, Roßbergweg 42 JavaScript, C++ Engineering - The ultimative DHTML engine: http://gml-modul.sourceforge.net - http://sourceforge.net/projects/gml-modul .