//both html dom interactions and random JavaScript topics are in this file,

document.addEventListener("DOMContentLoaded", ()=> {

    const body = document.getElementById("bod");
    const div = document.createElement("div");
    div.innerText = "What time is it?";
    body.appendChild(div);

    let currentTime;
    const timeDiv = document.createElement("div");
    body.appendChild(timeDiv);

    setInterval(()=>{
        currentTime = new Date();
        const hours = currentTime.getUTCHours() - 5;
        const mins = currentTime.getUTCMinutes();
        const seconds = currentTime.getUTCSeconds();

        timeDiv.innerText = `${ hours > 12 ? hours - 12 : hours}:${mins < 10 ? `0${mins}` : mins}:${seconds < 10 ? `0${seconds}` : seconds} CT`;
    },1000);


    //Just JS stuff below

    function addingRecursion(...args){
        if (args.length === 0) return 0;
        return args[0] + addingRecursion(...args.slice(1));
    }

    console.log(addingRecursion(1,3,4,7,5,3));

    function canHardly(num1,num2){
        return num1 + (function(){return num2 ** 2;})();
    }

    console.log(canHardly(1,8));

    function imGonnaReturnMyself(){
        console.log("completing complex algo for self returnation")
        return imGonnaReturnMyself;
    }

    const returned = imGonnaReturnMyself();

    const counterFactory = () => {
        let count = 0;
        return (
            () => {
                count++;
                console.log(count);
            }
        )
    }

    const counter1 = counterFactory();
    counter1();
    counter1();



    if (2 == "2"){
        let arr = [1785,2 % 5,34, 2 == "2"];

        for (let el of arr){
            console.log(el);
        }

    }

    const a = 10;

    switch (a) {
        case 10:
            console.log("I'm 10");
            break;
        case 21:
            console.log("wow");
            break;
        case "10":
            console.log("string>");
            break;
    }
    
    


})