Attempting to splice an array but encountering index issues
var kode_pelayanan = [];
function deleteKodePelayanan(index){
kode_pelayanan.splice(index, 1);
console.log(kode_pelayanan);
}
Experimented in the console with an array for kode_pelayanan
. This array is obtained from input.
kode_pelayanan array ["LB1", "LB2", "LHA01", "LHA02"]
However, upon executing the deleteKodePelayanan()
function and attempting to splice LB2
, the resulting value is:
["LB2", "LHA01", "LHA02"]