I have an array of heart rate, height, and weight values.
{
"heart_rate": 27,
"height": 82,
"weight": 78
}
There is also a second array containing information about each value, such as ID, label, and description.
[
{
"id": "heart_rate",
"description": "le ratio coeur",
"label":"ratio coeur"
},
{
"id": "height",
"label": "taille",
"description": "la taille"
},
{
"id": "weight",
"label": "poids",
"description": "le poids"
}
]
My question is, can I use the map
function to match the key of the first array with the ID of the second array in order to create a new result array like this?
[
{
"label": "poids",
"value": 82,
"description": "le poids"
},
{
"label": "taille",
"value": 78,
"description": "la taille"
},
{
"label": "ratio coeur",
"value": 27,
"description": "le ratio coeur"
},
]