JSFiddle - React, Tailwind, and code Playground
JavaScript
var str = '';
do {
str = prompt('enter a string with trailing number', '');
alert(str.replace(/\d+$/, ''));
} while(str != '');
var str = '';
do {
str = prompt('enter a string with trailing number', '');
alert(str.replace(/\d+$/, ''));
} while(str != '');