If you are looking to merge two arrays while putting values of the second one at the beginning, you can use destructuring:
arr1 = [
{
"id":4390,
"name":"panadol"
},
{
"id":4392,
"name":"aspirin"
},
{
"id":1390,
"name":"vantage"
},
{
"id":2390,
"name":"cream"
},
]
arr2 = [
{
"id":3390,
"name":"morphine"
},
{
"id":3231,
"name":"flagyl"
},
]
console.log([...arr2, ...arr1])
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…