mercredi 24 avril 2019

Is there away to access whats inside a function with an onclick event?

**So, I want to know if its possible to access whats inside a function and use it on an onClick event.

For example:

   function random(){
       Math.floor(Math.random()*2+1)
   }

And my question is; I want to use the If statement for whats inside the function.

    if(random number ===1) do something on onClick event.




Aucun commentaire:

Enregistrer un commentaire