javascript Map
来源:互联网 发布:淘宝禁用词处罚 编辑:程序博客网 时间:2024/04/28 06:34
function pair(key, value) {
this.key = key;
this.value = value;
}
function put(key, value) {
for (var i = 0; i < this.map.length; i++) {
if (this.map[i].key == key) {
this.map[i].value = value;
return;
}
}
this.map[this.map.length] = new pair(key, value);
}
function get(key) {
for (var i = 0; i < this.map.length; i++) {
if (this.map[i].key == key)
return this.map[i].value;
}
}
function remove(key) {
for (var i = 0; i < this.map.length; i++) {
if (this.map[i].key == key) {
for (var j = i; j < this.map.length - 1; ++j)
this.map[j] = this.map[j+1];
return;
}
}
}
function getCount(){
return this.map.length;
}
function isEmpty(){
return this.map.length == 0;
}
function classMap() {
this.map = new Array();
this.get = get;
this.put = put;
this.remove = remove;
this.getCount = getCount;
this.isEmpty = isEmpty;
}
this.key = key;
this.value = value;
}
function put(key, value) {
for (var i = 0; i < this.map.length; i++) {
if (this.map[i].key == key) {
this.map[i].value = value;
return;
}
}
this.map[this.map.length] = new pair(key, value);
}
function get(key) {
for (var i = 0; i < this.map.length; i++) {
if (this.map[i].key == key)
return this.map[i].value;
}
}
function remove(key) {
for (var i = 0; i < this.map.length; i++) {
if (this.map[i].key == key) {
for (var j = i; j < this.map.length - 1; ++j)
this.map[j] = this.map[j+1];
return;
}
}
}
function getCount(){
return this.map.length;
}
function isEmpty(){
return this.map.length == 0;
}
function classMap() {
this.map = new Array();
this.get = get;
this.put = put;
this.remove = remove;
this.getCount = getCount;
this.isEmpty = isEmpty;
}
- javascript Map
- JavaScript-Map
- javascript Map
- javascript map
- JavaScript Map
- javascript中的map
- JavaScript实现的Map
- javascript遍历map
- javascript map 效果
- javascript 实现 Map 工具包
- javascript中的Map实现
- JavaScript Map实现
- JavaScript Source Map 详解
- JavaScript Source Map 详解
- JavaScript 自定义map
- JavaScript Source Map
- JavaScript Source Map
- javascript实现Map
- JFreeChart中画3D饼图
- 细说HTML元素的ID和Name属性的区别
- 不良词语过滤 (jsp)例子:留言本
- 表单对象textarea内容的格式控制(回车、换行、空格)
- Request中有多种方法获取url信息
- javascript Map
- 支持google、baidu、Yahoo的站内搜索的代码
- 在JavaScript面向对象编程中使用继承(2)
- 一个简单的加密算法Kaiser(C语言实现)
- C语言实现SMTP协议发送邮件
- 如何给指定的asp.net控件添加样式
- C语言实现的井字棋
- GIS中的“胖瘦”
- Windows XP下巧妙锁定桌面