It's the only sensible way. jQuery provides jQuery.each( obj/arr, function() ) to iterate over arrays/objects, which boils down to using the for...in construct. To remove properties from an object ... eg. delete obj.x2;
On Oct 11, 8:57 am, Pops <[EMAIL PROTECTED]> wrote: > Is this the only way to iterate through an object? > > for ( x in myObject) { > } > > and how can you remove an field in an object? > > For example: > > var obj = { > x1: 1123, > x2: 212, > x3: 123131 > }; > > I want to remove obj.x2 the obj object to end up with: > > { x1: 1123, x3: 123131} > > Thanks > > -- > HLS