Skip to content
Advertisement

Split object into two and renumerate keys

I would like to split an object into two parts according to property “amount” (empty string)

JavaScript

}

to this

JavaScript

I’m close to solving it but after numerous attempts (push, assign, map) it still does not work. Thx.

Advertisement

Answer

You can acheive your goal like this:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement