标签:java io ar cti javascript on sp return
var items= [
{
name: ‘Tony‘,
age: 54
},
{
name: ‘Yuk‘,
age: 52
},
{
name: ‘Jamo‘,
age: 65
}
];
要将数组元素的 name 属性取出来重新组成一个数组,要求顺序不变,效果如下:
[‘Tony‘, ‘Yuk‘, ‘Jamo‘]
答案:
var r=items.map(function(o){return o.name})
javascript操作之循环,布布扣,bubuko.com
标签:java io ar cti javascript on sp return
原文地址:http://my.oschina.net/guomingliang/blog/300700