Posts

How to map object to Array only for first level. JS

Image
0 I have the object: obj = { a: 'aVal', b: { bSub_1: 'bSub_1_value', bSub_2: 'bSub_2_value' } } I need to map this object to an array ['aVal', {bSub_1: 'bSub_1_value', bSub_2: 'bSub_2_value'}] I try to use Object.values(obj) but this approach cast all object levels to the array, however, I need casting only first. How I can do this? javascript arrays share | improve this question asked Nov 14 '18 at 12:52 Pavel Pavel 449 5 22 ...