Javascript's toSource() is fun

tools

js> x = { "name" : 'Duck', "surname" : 'Donald' } [object Object]

js> x.toSource() ({surname:"Donald", name:"Duck"})

js> x.f = function(i) { return i+2; }

function (i) { return i + 2; }

js> x.f(12) 14

js> x.toSource() ({surname:"Donald", name:"Duck", f:(function (i) {return i + 2;})})

See the reference for more info.