+ 1
JS: Random number picker [help]
I’m trying to make a random number picker app with range (input1 - input2). Why do I just get 0? Or, umm... how do I make it work? I’ve tried everything I can, I give up. —— https://code.sololearn.com/WyvJUoo30cRT/?ref=app
4 odpowiedzi
+ 1
parseInt the input because they are string
+ 1
yes very close now
now move commented line 9 line 10 to beginning of chooseNum()
explain why 2 to 4 gives 02 and 12
the result is not outside range.
is because minValue is string, computed floor result 0 or 1 concantention with the string 2.
0
the outside close bracket before + sign
floor, then add min
0
Gordon , yeah, that leads to a different problem.
It makes other random numbers without the range.
__