assets/js/script.js
// Rendering the search history by creating elements that are prepended to the search history article
Rendering the search history by creating elements that are prepended to the search history article
Rendering the search history by creating elements that are prepended to the search history article
function renderSearchHistory() {
    while(searchHistoryArticle.firstChild) {
        searchHistoryArticle.removeChild(searchHistoryArticle.firstChild);
    }
    for(i = 0; i < searchHistoryArray.length; i++) {
        let searchHistoryItem = document.createElement('button');
        searchHistoryItem.textContent = searchHistoryArray[i];
        searchHistoryItem.setAttribute('data-search-history', i);
        searchHistoryItem.setAttribute('class', 'button is-fullwidth is-primary is-outlined mb-1 p-1 search-city');
        searchHistoryArticle.prepend(searchHistoryItem);
        searchHistoryClick();
    }
}
function renderSearchHistory ( ) { while ( searchHistoryArticle . firstChild ) { searchHistoryArticle . removeChild ( searchHistoryArticle . firstChild ) ; } for ( i = 0 ; i < searchHistoryArray . length ; i ++ ) { let searchHistoryItem = document . createElement ( 'button' ) ; searchHistoryItem . textContent = searchHistoryArray [ i ] ; searchHistoryItem . setAttribute ( 'data-search-history' , i ) ; searchHistoryItem . setAttribute ( 'class' , 'button is-fullwidth is-primary is-outlined mb-1 p-1 search-city' ) ; searchHistoryArticle . prepend ( searchHistoryItem ) ; searchHistoryClick ( ) ; } }
Rendering the search history by creating elements that are prepended to the search history article
Rendering the search history by creating elements that are prepended to the search history article