Code after request:
var posts = [
{
"id":268,
"title":{
"rendered":"Koala"
},
"categories":[2]
}
]
var categories = [
{
"id":2,
"name":"Animals"
},
{
"id":3,
"name":"Birds"
},
]
Goal: - Create a function that takes posts.categories value and replace it with matching id of categories.name.
Result:
var posts = [
{
"id":268,
"title":{
"rendered":"Koala"
},
"categories":["Animals"]
}
]
I have searched around, but could not find a solution. Can someone please help me with this issue?