javascript string replace last occurrence code example Example: javascript replace last character Click to copyvar str1 = "Notion,Data,Identity,".replace(/.$/,".")