I want to remove all occurrences of substring = . in a string except the last one.
.
E.G:
1.2.3.4
should become:
123.4
You can use regex with positive look ahead,
"1.2.3.4".replace(/[.](?=.*[.])/g, "");
2.1m questions
2.1m answers
60 comments
56.9k users