TrumpTower,
const cities = [];
while (true) {
let city = prompt('Введите город');
if (!city) break;
city = city.replace(/[ЪЬЫ]+$/ig, '');
let includes = cities.includes(city);
if (includes) {
alert(`${city} такой город есть в списке`);
} else {
cities.push(city);
alert(`${city} добавлен в список`);
}
}