<SCRIPT LANGUAGE="JavaScript">
var map = new Object();
map['whatever'] = 1;
map['something'] = 2;
map['other'] = 3;
/*
var map = new Object();
map.whatever = 1;
map.something = 2;
map.other = 3;*/
alert(map.other);
map.other=1;
alert(map.other);
</SCRIPT>
New Technologies
- Java
- Javascript
- DTML
- Dot Net
- ASP .Net
- C# .Net
- PHP
Monday, December 10, 2007
HashMap in JavaScript example1
<SCRIPT LANGUAGE="JavaScript">
var targInfo = {
Set : function(foo,bar) {this[foo] = bar;},
Get : function(foo) {return this[foo];}
}
targInfo.Set('AT33', Array('N18',5,60));
foo='AT33';
alert(targInfo.Get(foo));
alert(targInfo[foo][1]);
</SCRIPT>
var targInfo = {
Set : function(foo,bar) {this[foo] = bar;},
Get : function(foo) {return this[foo];}
}
targInfo.Set('AT33', Array('N18',5,60));
foo='AT33';
alert(targInfo.Get(foo));
alert(targInfo[foo][1]);
</SCRIPT>
Subscribe to:
Posts (Atom)