如何隐蔽或将数组元素添加到对象中。
现在
arr = [
["1/1/2017",113],
["3/11/2017",58],
["3/12/2017",70],
["3/13/2017",76]
]
应该
arr = [
{date:"1/1/2017", count:113},
{date:"3/11/2017", count:58},
{date:"3/12/2017", count:70},
{date:"3/13/2017", count:76}
]
arr.map(function(arr1) {
return {
date : arr1[0],
count : arr1[1]
}
})
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句