Replace the object at the specified location in the json array

var arr = [{id:1,pic:1},{id:2,pic:2},{id:3,pic:3}]

how to delete the second item of arr and insert a new object {id:4,pic:4}
results such as

arr = [{id:1,pic:1},{id:4,pic:4},{id:3,pic:3}]
Aug.12,2021

arr.splice (1,1, {id:4,pic:4});

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-11ad7e7-3cf9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-11ad7e7-3cf9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?