string title = "title1";
If I want to make it title2 how can I?
as I cant convert whole as int, may something like cropping or trimming ?
title suffix(1) is not a fixed number
just I want to alter the last digit which always be a int
title = title.slice(0,-1) + (+title.replace(/\D/g, '') + 1);
or
title = title.slice(0,-1) + (+title.slice(-1) + 1);
or
title = title.replace(/\d+/g, function(x) {return ++x});
return (+x)+1 can be written as return ++x
title = title.replace('1', '2');title = title.slice(0,-1) + 2;