【发布时间】:2018-10-13 01:54:57
【问题描述】:
var json = [{one: "text1", two: "text2", three: 3, four: 4},
{one: "text3", two: "text4", three: 5, four: 6},
{one: "text5", two: "text7", three: 8, four: 9}]
如何将上面的对象数组转换成下面的数组?
var array = [["text1", "text2", 3, 4],
["text3", "text4", 5, 6],
["text5", "text7", 8, 9]]
是否有 ES2015 函数可以帮助轻松转换它?如果不是 for 循环可能会这样做。
【问题讨论】:
-
你拥有的是一个对象数组,而不是 JSON。
标签: javascript ecmascript-6 javascript-objects