issue with comparing two numbers in javascript

前端 未结 5 2017
滥情空心
滥情空心 2020-11-29 11:29

my html code is like:




        
5条回答
  •  长情又很酷
    2020-11-29 11:32

    When you compare two strings in an if statement:

    if ( l > h) {}    
    when l = "12" and h = "112"
    

    It compares these two values as strings as "3" > "1". It says l > h is true

提交回复
热议问题