I want to split both the following string and put the index number in each with the . (dot) at the end.
let str1 = "1. sun ; moon ; star ; god ; goddess";
// will work with both the string
let str2 = "sun; moon; star; god; goddess;";
Result should be like this
let result = "1. sun\n2. moon\n3. star\n4. god\n5. goddess.";
Or as below if executed
1. sun.
2. moon.
3. star.
4. god.
5. goddess.
Update: I splitted it but failed to put the index number in each word. Since the words are random e.g. one can have 3 words and other can have the 5 words and so on...