r3 - 23 Jun 2006 - 11:11:05 - MatthewEernisseYou are here: OSAF >  Documentation Web  >  ScoobyJavaScriptLibraries > JavaScriptHash > JavaScriptHashMethodReplaceKey

replaceKey

Class

Method of Hash

Library

hash.js

Syntax

exampleHash.replaceKey(oldKey, newKey);

Parameters

oldKey A string of the key to be replaced. newKey A string of the key to replace the old key with.

Description

Replaces a key in the Hash with a new one. It an item for newKey already exists, the value is overwritten with the one from oldKey.

Examples

var badSciFi = new Hash();
movie = '';

badSciFi.setItem("Connery", "Zardoz");
badSciFi.setItem("York", "Logan's Run");
badSciFi.setItem("Douglas", "Saturn 3");

movie = badSciFi.getItem('York');        // movie is set to "Logan's Run"
badSciFi.replaceKey('York', 'Ustinov');
movie = badSciFi.getItem('Ustinov');     // movie is still set to "Logan's Run"
GlossaryForm
DisplayName Change Me!
GlossaryTermCategories

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | 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.