let search_link = document.querySelector('.search_link');
let search_a = document.querySelector('.search_a');
search_a.addEventListener('click', function() {
// вариант 1
if (!search_link.value) {
search_link.classList.toggle('search_link_active');
return;
}
// вариант 2
search_link.classList.add('search_link_active');
})
function places() {
const places = [...PlacesList];
const sortedPlaces = {};
for (const place of places) {
const letter = place.name[0];
if (!(letter in sortedPlaces)) {
sortedPlaces[letter] = [];
}
sortedPlaces[letter].push(place);
}
return Object.values(sortedPlaces);
}