how to replace the last character of a string in javascript code example Example: javascript replace last character var str1 = "Notion,Data,Identity,".replace(/.$/,".")