js the method of reading from the input box and comparing the sizes of two numbers

  • 2021-08-03 08:52:48
  • OfStack

Because the contents read from the input box are of String type, if you compare directly, you should use asc code to compare. If you want to compare the size of numbers, you should add parseFloat.

For example:

if(parseFloat(amnt1) < parseFloat(amnt2)){}


Related articles: