var Dictionary = function(){
var dictionary = {};
//检查键是否存在
= function(key){
return (key);
}
//添加元素
= function(key , value){
dictionary[key] = value;
}
//通过键移除元素
= function(key){
if((key)){
delete dictionary[key];
return true;
}else{
return false;
}
}
//由键获取值
= function(key){
if((key)){
return dictionary[key];
}else{
return undefined;
}
}
//提取字典所有值
= function(){
var values = [];
for(var key in dictionary){
if((key)){
(dictionary[key]);
}
}
return values;
}
//获取全部键名
= function(){
return (dictionary);
}
//清除字典
= function(){
dictionary = {};
}
//获取字典长度
= function(){
return (dictionary).length;
}
}