typescript定义字典方式
//key为string , value为number
var map: { [key: string]: number; } = {
"t" : 3,
"o" : 5,
"g" :10
};
for(let k in map){
console.log(map[k]);
}
var map: { [key: string]: number; } = {
"t" : 3,
"o" : 5,
"g" :10
};
for(let k in map){
console.log(map[k]);
}