
temp是一组j'son字符串,现在想循环遍历其中的某个值并把其存入到js创建的新的map里边,但是我这么写最后map里边只是遍历map的最后一个值
看下如下是否是你要的结果
var temp=[{'ipCount':'1'},{'ipCount':'2'},{'ipCount':'3'},{'ipCount':'4'}];var map = [];for(var key in temp){map.push( {'countyName':temp[key].ipCount});console.log('map'+map);};