I have a array of object in javascript
const arr = [
{key: 'freq', value: '1'},
{key: 'freq', value: '2'},
{key: 'param', value: 'true'},
{key: 'param', value: 'fasle'}
]
and need some logic there I would like to get result something like below result
const result = `{
"freq_1_param_true": {
"freq": 1,
"param": true
},
"freq_2_param_true": {
"freq": 2,
"param": true
},
"freq_1_param_false": {
"freq": 1,
"param": false
},
"freq_2_param_false": {
"freq": 2,
"param": false
}
}`
New contributor
Smita is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1