Dictionary.Item() (Method)

Returns a reference to the Item container for a key.


JScript - 3.0
Internet Explorer - 4.0
Property/method value type:Reference to an item pocket
JavaScript syntax:IEmyDictionary.Item(aKey)
IEmyDictionary.Item(aKey) = aValue
Argument list:aKeyA textual key name
aValueA value to store for the key

This method provides a way to extract an item from the Dictionary using its key name as an accessor.

This method can also be used as an alternative to the Dictionary.add() method although its syntax for doing so is unusual.

These two lines of code are syntactically different but functionally the same when creating a new name-value pair:

myDictionary.add("KEY1", "an item text");

myDictionary.item("KEY1") = "an item text";

This suggests that you can use the add() method to replace an item but in fact that will cause an error. The item() ,method, used as if it were an LValue property is the only way to replace an item content.