Javascript String Compare == sometimes fails

后端 未结 9 2048
你的背包
你的背包 2020-12-05 17:25

How could the following code sometimes evaluate to false?

(transport.responseText == \'1\' || 
 transport.responseText == \'CARD_VALID\')

M

9条回答
  •  情歌与酒
    2020-12-05 18:19

    If you want something a little less complicated and you are dealing with NUMERIC VALUES, use

    parseFloat()
    

    works like a charm

提交回复
热议问题