sdy

Delete main.js

1 -const countries = [
2 - {name: 'USA'},
3 - {name: 'India'},
4 - {name: 'Argentina'},
5 - {name: 'Armenia'},
6 - {name: "korea"},
7 - {name: "lorem ipsum test filter"}
8 -];
9 -
10 -const searchInput = document.querySelector('.search-input');
11 -const suggestionsPanel = document.querySelector('.suggestions');
12 -
13 -searchInput.addEventListener('keyup', function() {
14 - const input = searchInput.value;
15 - suggestionsPanel.innerHTML = '';
16 - const suggestions = countries.filter(function(country) {
17 - return country.name.toLowerCase().startsWith(input);
18 - });
19 - suggestions.forEach(function(suggested) {
20 - const div = document.createElement('div');
21 - div.innerHTML = suggested.name;
22 - suggestionsPanel.appendChild(div);
23 - });
24 - if (input === '') {
25 - suggestionsPanel.innerHTML = '';
26 - }
27 -})
...\ No newline at end of file ...\ No newline at end of file