我一直在这里一段时间,无法弄清楚我有什么以及如何使用它。从现有对象创建新对象
当我使用console.log
,我得到这个回:
description:"Some text here"
id:1234
location:Array(1)
name:"Some Name"
tags:
Array(7)
0:Object
name:"Landmark"
public_id:"landmark"
__proto__
1:Object
name:"Park"
public_id:"park"
__proto__
我期待得到的东西是这样的:
{id:1234,tags:[landmark,park]}
我可以得到id
部分罚款与此:
var thePlaces=[];
$.each(data, function(index, val) {
thePlaces.push({
id:val.id
})
})
我该如何去添加标签到各自的id
现在?
你的对象似乎代表着你想要什么已经。 –