JS里对象的值如何加属性呢?
比如对象:varobject1={"1":"张三","2":"李四"};要怎么写才能变为在前面添加id和name属性变为:vararr=[{"id":"1","name"...
比如对象:
var object1 ={"1": "张三","2": "李四"};
要怎么写才能变为在前面添加id和name属性变为:
var arr =[
{"id":"1","name": "张三"},
{"id":"2","name": "李四"},
]; 展开
var object1 ={"1": "张三","2": "李四"};
要怎么写才能变为在前面添加id和name属性变为:
var arr =[
{"id":"1","name": "张三"},
{"id":"2","name": "李四"},
]; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询