When using delete on an item in an Array, the length property is not updated. : Dictionary « Array « Flash / Flex / ActionScript






When using delete on an item in an Array, the length property is not updated.

 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var pastas:Object = {t: 2, g: 14, s: 9};
        trace(pastas.length); // Displays 9
        delete pastas["s"];
        trace(pastas.length); // Displays undefined

    }
  }
}

        








Related examples in the same category

1.Working with Associative Arrays
2.Using an Object as a Lookup Key with Dictionaries
3.Iterate through the key-value pairs of an object with the for..in and for each..in loops.