<script>
//定義一個全域性map
var map = {};
var key0 = "0";
var key1 = "1";
map[key0] = "0-真實報文";
map[key1] = "1-虛擬報文";
//row 獲取這行的值 ,index 獲取索引值
function testJsMap(key){
//如果遍歷map
for(var prop in map){
if(map.hasOwnProperty(prop)){
console.log(" key is " + prop +" and value is " + map[prop]);
}
var value = map[key];
return value;
</script>
<script>
//定義一個全域性map
var map = {};
var key0 = "0";
var key1 = "1";
map[key0] = "0-真實報文";
map[key1] = "1-虛擬報文";
//row 獲取這行的值 ,index 獲取索引值
function testJsMap(key){
//如果遍歷map
for(var prop in map){
if(map.hasOwnProperty(prop)){
console.log(" key is " + prop +" and value is " + map[prop]);
}
}
var value = map[key];
return value;
}
</script>