Dictionary.Items()

JScript3.0+Syntax

							dictionaryobj.Items()

Description

The Items() method of the Dictionary object returns all the items in the dictionary in an array.

Example

Listing 9.20 uses Items() method to retrieve all the items that are in the dictionary.

Listing 9.20 Retrieve Array of Items Using Items() Method
<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("G","grape");
fruits.Add("O","orange"); //Create an array theArray = (new VBArray(fruits.Items())).toArray(); document.write("The array contains:<br>"); //Display items in array for (i in theArray) { document.write("theArray[",i,"]=",theArray[i],"<br>"); ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.