Task

The goal is to create an associative array (also known as a dictionary, map, or hash).



Related tasks:

 Associative arrays/Iteration
 Hash from two arrays


See also

 Array
 Associative array: Creation, Iteration
 Collections
 Compound data type
 Doubly-linked list: Definition, Element definition, Element insertion, List Traversal, Element Removal
 Linked list
 Queue: Definition, Usage
 Set
 Singly-linked list: Element definition, Element insertion, List Traversal, Element Removal
 Stack


var map:Object = {key1: "value1", key2: "value2"};
trace(map['key1']); // outputs "value1"
 
// Dot notation can also be used
trace(map.key2); // outputs "value2"
 
// More keys and values can then be added
map['key3'] = "value3";
trace(map['key3']); // outputs "value3"