dft=["t", "h", "i", "s", "I", "s", "S", "p", "i", "n", "a", "l", "T", "a", "p"];
ans=[4, 6, 12, -1];
for(x=0;x<ans-1;x++){
dft.splice(ans[x],0,"-");}
return dft;
I am trying to return an array that has "-" placed into the dft array using the indexes in the ans array except the -1 index.
result im getting is ["t", "h", "i", "s", "I", "s", "S", "p", "i", "n", "a", "l", "T", "a", "p"]