async function initializeGifsNew(NumberOfCategories, offset) {
    getTrendingGifs(NumberOfCategories, apiKey);

    const searchTermArray = await getTrendingArray(apiKey);
    const randomSearchTermArray = await getRandomTrends(searchTermArray, 10);
    await console.log(searchTermArray);
    //await console.log(randomSearchTermArray);
    randomSearchTermArray.forEach((element, index) => {
        const searchResult = searchAPI(element, 1, apiKey, offset, rating, language);
        searchResult
            .then(obj => obj.data)
            .then(gifArray => {
                const resultSection = document.querySelector(".gif-results");
                gifArray.forEach((element) => {
                    const gifDiv = createGifResultBox(element.images.original.url, "gifTags");
                    gifDiv.className = (index + 1) % 5 === 0 ? "gif-result-box large" : "gif-result-box";
                    resultSection.appendChild(gifDiv);
                });
                console.log(gifArray);
            })
            .catch(error => console.log(error));
    })
}
// fills the gif grid -- WORK IN PROGRESS
fills the gif grid -- WORK IN PROGRESS
fills the gif grid -- WORK IN PROGRESS
async function initializeGifsNew(NumberOfCategories, offset) {
    getTrendingGifs(NumberOfCategories, apiKey);
    const searchTermArray = await getTrendingArray(apiKey);
    const randomSearchTermArray = await getRandomTrends(searchTermArray, 10);
    await console.log(searchTermArray);
    randomSearchTermArray.forEach((element, index) => {
        const searchResult = searchAPI(element, 1, apiKey, offset, rating, language);
        searchResult
            .then(obj => obj.data)
            .then(gifArray => {
                const resultSection = document.querySelector(".gif-results");
                gifArray.forEach((element) => {
                    const gifDiv = createGifResultBox(element.images.original.url, "gifTags");
                    gifDiv.className = (index + 1) % 5 === 0 ? "gif-result-box large" : "gif-result-box";
                    resultSection.appendChild(gifDiv);
                });
                console.log(gifArray);
            })
            .catch(error => console.log(error));
    })
}
async function initializeGifsNew ( NumberOfCategories , offset ) { getTrendingGifs ( NumberOfCategories , apiKey ) ; const searchTermArray = await getTrendingArray ( apiKey ) ; const randomSearchTermArray = await getRandomTrends ( searchTermArray , 10 ) ; await console . log ( searchTermArray ) ; randomSearchTermArray . forEach ( ( element , index ) => { const searchResult = searchAPI ( element , 1 , apiKey , offset , rating , language ) ; searchResult . then ( obj => obj . data ) . then ( gifArray => { const resultSection = document . querySelector ( ".gif-results" ) ; gifArray . forEach ( ( element ) => { const gifDiv = createGifResultBox ( element . images . original . url , "gifTags" ) ; gifDiv . className = ( index + 1 ) % 5 === 0 ? "gif-result-box large" : "gif-result-box" ; resultSection . appendChild ( gifDiv ) ; } ) ; console . log ( gifArray ) ; } ) . catch ( error => console . log ( error ) ) ; } ) }
fills the gif grid -- WORK IN PROGRESS
fills the gif grid -- WORK IN PROGRESS
//await console.log(randomSearchTermArray);