allisonthuang.github.io

For our Jekyll Static read.me site

View the Project on GitHub

Home DS Project Test Prep/Notes Create Task

Create Task from Tri 2

Plan and Writeup

Runtime Video, Final Committed Program Code & Written Response to Create Task

Things I want to Add/Change

Code Snippets

List usage
<script>
    const good = [ "That's not the worst", "OK you'll be fine", "Stay safe!" ];
    const bad = [ "Evacuate your family immediately.", "GET OUT. NOW!", "Find shelter immediately!" ];
</script>
Conditional Statement & Call
`<script>
    function magnitude(mag){
        if ((parseInt(mag) == 1) || (parseInt(mag) == 2) || (parseInt(mag) == 3)) {
            const magni = Math.floor(Math.random() * good.length);
            console.log(magni, good[magni]);
            document.getElementById("arrPrint").innerHTML = good[magni];
        }
        else{
            const magni = Math.floor(Math.random() * bad.length);
            console.log(magni, bad[magni]);
            document.getElementById("badPrint").innerHTML = bad[magni];
        }
    }
</script>

Runtime