How can I add the function Math.floor when I click the button? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I add the function Math.floor when I click the button?

https://code.sololearn.com/WUzbfNkc95Va/?ref=app

15th May 2020, 10:32 AM
Kristo Kallfa
Kristo Kallfa - avatar
3 Answers
+ 2
Call the function on button using onclick event. BTW what is max here?
15th May 2020, 10:56 AM
A͢J
A͢J - avatar
0
The proper way would be to give your button an id like <button id="button">, and then, in your <script>, at the bottom: document.getElementById("button").addEventListener("click", function () { // and here you can do whatever! getRandomArbitrary(); alert("hello!"); });
15th May 2020, 10:58 AM
Schindlabua
Schindlabua - avatar
0
User input is the “min” variable.Random number by game is “max” variable.So , when the user will click play after he input the number I want to output smth like “Your number is correct.You won”.But I can’t do this even with your answers...
15th May 2020, 11:25 AM
Kristo Kallfa
Kristo Kallfa - avatar