August 1999
Intermediate to advanced
1488 pages
72h 53m
English
dictionaryobj.Add(key, item)
The Add() method of the Dictionary object adds new items to the dictionary using key, item pairs. The item can be of any type, but the key cannot be an array. Nothing is returned from this method.
Listing 9.16 creates a fruit dictionary and then uses the Add() method to add fruit items to the dictionary.
<html>
<script language="JScript">
<!-- Hide
//Create dictionary
var fruits = new ActiveXObject("Scripting.Dictionary");
//define elements of dictionary
fruits.Add("A","apple");
fruits.Add("B","berry");
fruits.Add("O","orange");
</html>
|
Read now
Unlock full access