Friday, October 06, 2006

Native object serialization in JavaScript (mozilla only)

Check it out:
a = new Object(); = "daniel";
b = new Object();
b.a =a;
b.createDate = new Date();
b.index= 4;

results in :
({a:{name:"daniel"}, createDate:(new Date(1160162836203)), index:4})

even more, it supports circular reffrencing check out the next example

a = new Object();
b = new Object();
c = new Object();
c.b = b;
c.a = a;
a.b= b;
b.a =a;
b.c = c;
the result will be:
#1={a:#2={b:#1#}, c:{b:#1#, a:#2#}}

there are some js libraries that mock that feature in ie also ,
more to come.


Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home