Answers for "console.table in js without index column"

0

console.table in js without index column

const array = [{myId: 42, name: 'John', color: 'red'}, {myId: 1337, name: 'Jane', color: 'blue'}]

const transformed = array.reduce((acc, {myId, ...x}) => { acc[myId] = x; return acc}, {})

console.table(transformed)
 Run code snippet
Posted by: Guest on March-19-2022

Code answers related to "console.table in js without index column"

Code answers related to "Javascript"

Browse Popular Code Answers by Language