Edit in JSFiddle

strToArray.splice(elementToDelete, 1, after);
console.log(strToArray); //Outputs the new array with words replaced