Dictionary.Add() (Method)

Add a new item to the Dictionary.

Availability:

JScript - 3.0
Internet Explorer - 4.0
JavaScript syntax:IEmyDictionary.Add(aKey, aValue)
Argument list:aKeyA textual key name
aValueA value to store for the key

This method adds a new item to the Dictionary associating it with the key name being passed.

Keys are meant to be strings but will be coerced as necessary during the addition. However, you cannot use an Array object to build the key name. If you do need to build a key name from an array, you must convert it to a string first.

The items being associated with Dictionary keys can be of any type.

You cannot replace an item with this method as a run time error is caused by an attempt to add a new object where the key name has already been used.