new AssociativeArray
A collection of key-value pairs that is stored as a hash for easy lookup but also provides an array for fast iteration.
Source:
Members
-
length :Number
-
Gets the number of items in the collection.
-
values :Array
-
Gets an unordered array of all values in the collection. This is a live array that will automatically reflect the values in the collection, it should not be modified directly.
Methods
-
get
-
Retrieves the value associated with the provided key.
Parameters:
Name Type Description key
String | Number The key whose value is to be retrieved. Returns:
Object The associated value, or undefined if the key does not exist in the collection. -
remove
-
Removes a key-value pair from the collection.
Parameters:
Name Type Description key
String | Number The key to be removed. Returns:
Boolean True if it was removed, false if the key was not in the collection. -
removeAll
-
Clears the collection.
-
set
-
Associates the provided key with the provided value. If the key already exists, it is overwritten with the new value.
Parameters:
Name Type Description key
String | Number A unique identifier. value
Object The value to associate with the provided key.