I have a project involving managing email responses, where the reply function includes pre-written content like Re: ${Subject of the email}
The issue I'm facing is that after the 2nd reply, there is a repeated Re:
, so I created a function to remove it:
subject = document.querySelector('#compose-subject').value;
if (subject.includes("Re: ")){
subject = subject.replace("Re: ", "");
}
How can I modify this code to only work for duplicates, such as Re: Re:
(removing the 2nd Re:
)?
Currently, the code removes the first occurrence of Re:
even though I want it to target the second one. How should I go about implementing this change?