I get an object that is the return of a function in javascript, what I want to do is add a result at the beginning and at the end of the list of results, how do I combine the 2 objects and the result is like the example at the end, Thank you
the return is something like this
{
"results": [
{
"id": 29,
"text": "carpeta",
"icon": "far fa-folder",
"color": "#000000",
"state": 2
},
{
"id": 116,
"text": "carpeta2",
"icon": "far fa-folder",
"color": "#000000",
"state": 2
}
],
"pagination": {
"more": false
}
}
what I want to add is, something like this, at the beginning and at the end and combine the 2 object
{
"results": [
{
"id": 0,
"text": "Nueva Categoria",
"icon": "fas fa-plus fa-xl",
"color": "#000000",
"state": 2
}
]
}
so that something like this remains
{
"results": [
{
"id": 0,
"text": "Nueva Categoria",
"icon": "fas fa-plus fa-xl",
"color": "#000000",
"state": 2
},
{
"id": 29,
"text": "carpeta",
"icon": "far fa-folder",
"color": "#000000",
"state": 2
},
{
"id": 116,
"text": "carpeta2",
"icon": "far fa-folder",
"color": "#000000",
"state": 2
},
{
"id": 0,
"text": "Nueva Categoria",
"icon": "fas fa-plus fa-xl",
"color": "#000000",
"state": 2
}
],
"pagination": {
"more": false
}
}
I hope to make myself understood, thank you.