JavaScript Ganti karakter terakhir
var str1 = "Notion,Data,Identity,".replace(/.$/,".")
Huy Nguyen
var str1 = "Notion,Data,Identity,".replace(/.$/,".")
String.prototype.replaceLast = function (search, replace) {
return this.replace(new RegExp(search+"([^"+search+"]*)$"), replace+"$1");
}
str = "lala";
newStr = str.replaceLast("l", "m");
console.log(newStr);
let str = "12345.00";
str = str.substring(0, str.length - 1);