Delete object properties similiar like deleting array elements with splice?
We have object type variable in Jquery:
var obj = {"1234" : "xx", "4321" : "yy", "5555" : "hh", "2321" : "aa" };
Lets say that I want to delete every property from property name "5555" to
the end of the object(that means that I want to delete obj['5555'] and
delete obj['2321']). I am interested in smartest way, trough loop, to do
that.
In array I would use splice(2, arr.length) but I am confused.
I have some ides, but I don't think that they are smartest way to go, so I
ask you guys.
Thank You in Advance.
No comments:
Post a Comment