Answer the question
In order to leave comments, you need to log in
How to make an array of objects from an object?
There is an object {CHF: 9095, USD: 45966, UAH: 4324}
What to do to get a passive with objects of the form?:
[{amount:'CHF',currency: 9095},{amount:'USD',currency: 45966}, {amount:'UAH',currency: 4324}]
var arr= {CHF: 9095, USD: 45966, UAH: 4324},
summ = [];
_.transform(arr, function(result, n, key){
result['amount'] = n;
result['currency'] = key;
summ.push(result)
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question