I've an array of Json objects

var persons= [ {name:'peter', age:33}, {name:'john', age:27}, ..... ];

I want to extend every item with a new property with the same value,
by example, active:true

[ {name:'peter', age:33, active:true}, {name:'john', age:27,
active:true}, ..... ]

Now, I do

persons=persons.collect(function(p) {
        p.active=true;
        return p;
})

I think it does't the best method. Is there other more efficient
method? (the array is about 1000 length)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to