SOURCE

/**
 * 字典模型
 */
function Dictionary(){
    this.dataSoure = new Array()
    this.add = add
    this.remove = remove
    this.find = find
    this.showAll = showAll
    this.count = count
    this.clear = clear
}
function add(key,val){
    this.dataSoure[key] = val
}
function find(val){
    return this.dataSoure[key]
}
function showAll(){
    for(let key in Object.key(this.dataSoure).sort()){
        console.log(this.dataSoure[key])
    }
}
function count(){
    let count = 0
    for(let key in Object.key(this.dataSoure)){
        count++
    }
    return count
}
function clear(){
    for(let key in Object.key(this.dataSoure)){
        delete this.dataSoure[key]
    }
}
function find(val){
    for(let key in Object.key(this.dataSoure)){
        if(this.dataSoure[key] === val){
            return val
        }
    }
    return -1 
}
console 命令行工具 X clear

                    
>
console