I have a Array of Strings. Its a text with enumeration. So its like "1. abcde. 2. fghijk. There is no new line. I want to write a loop that detects the place where the "2." is and the place before it (array[I-1]) there should be included a \n for the new line. But I don't know a command for place a new element in an array without deleting the existing element on the same place. How can I do that ?
This is the code I got till now:
let el = document.getElementById('textinhalt').textContent;
for(let i = 0; i<el.length; i++){
if(el[i]=="2" && el[i+1]=="."){
}
}