Javascript将数组中的嵌套对象转换为数组

问题描述:

我需要一个嵌套数组,但是我有一个带有嵌套对象的数组.

I need a nested array, but I've got a array with nested objects.

我所拥有的:

[
    { id: 1, title: 'title', value: 'test data'}
    { id: 2, title: 'title', value: 'test data'}
]

但是我需要:

[
    [ 1, 'title', 'test data']
    [ 2, 'title', 'test data']
]

您可以在其上执行.map(x => Object.values(x)).

实时示例:

let src = [
    { id: 1, title: 'title', value: 'test data'},
    { id: 2, title: 'title', value: 'test data'}
];

let result = src.map(x => Object.values(x));

console.log(result);