r6 - 23 Jun 2006 - 11:11:35 - MatthewEernisseYou are here: OSAF >  Documentation Web  >  ScoobyJavaScriptLibraries > JavaScriptHash > JavaScriptHashMethodSetItem

setItem

Class

Method of Hash

Library

hash.js

Syntax

exampleHash.setItem(key, value);

Parameters

key A string indicating the key for the new item in the associative array.

value Whatever you want to store in that Hash position.

Description

Sets the value of the item in the Hash with that key to the desired value. Adds a new item if the key does not exist.

Examples

In the example below the Hash badSciFi will end up with three items in it.

var badSciFi = new Hash();

badSciFi.setItem("Connery", "Zardoz");
badSciFi.setItem("York", "Logan's Run");
badSciFi.setItem("Douglas", "Saturn 3");
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r6 < r5 < r4 < r3 < r2 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.