jeudi 13 août 2020

Trying to make a function do another function if a number has been reached

I want my random function to produce a number. Then, based on that number, I need it to execute a function.

My html:

<button class="button" onClick="random()">yes</button>

My Javascript:

var randomnum;

function random(1, 1) {
    var randomnum = return Math.random() * (1-1) + 1;

    if (var randomnum = 1) {
        return "togglePlay()";
    }
};

The range is 1-1 just because I am troubleshooting, but eventually I want more if statements in the function. Thank you!

Aucun commentaire:

Enregistrer un commentaire