There is an object within which other objects are accessible by keys:
segment0_0 segment0_1 segment1_0 segment1_1 I need to delete these elements from the object in the loop, because there can also be elements with keys segment2_0 , segment3_1 , etc. I tried to delete them in a nested loop, but for some reason the last element under the key segment1_1 never deleted:
for(let i = 0; i < Object.keys(rules).length; i++) { for(let j = 0; j < Object.keys(rules).length; j++) { if(rules[`airports_seg${i}_${j}`]) { delete rules[`airports_seg${i}_${j}`]; } } } How do I properly remove such items?