JSFiddle - React, Tailwind, and code Playground

by akang2

HTML

<!-- Day 3 Act 3.1 Write a function -->

JavaScript

//Day 3 Act 3.1 Write a function

//alert("Amy practiced " + allTime + " total hours");
// Amy played soccer for 15 years
// She practiced 2.5 hours, 4 times a week
// how many total years of practice is that?

function total_hours() {
    
    var years = parseInt(prompt("how many years?", "type it here duuuuuude"))||0;
    var hours_per_day  = 2.5;
    var times_per_week = 4;
    var weeks_per_year = 52;

    var hours_per_week = times_per_week * hours_per_day;
    var total_weeks    = weeks_per_year * years;

    var allTime = total_weeks * hours_per_week;

    /*if (allTime <= 4000) {
        alert("you need more practice");
    } else if(allTime > 4000 ) {
        alert("You have practiced " + allTime + " hours - good job!");
    } else {
        alert("tadaaaa");
    }*/
    console.log(allTime);
    
}

//now call function
total_hours();