如下,我发现F12调试的时候,客户端把&&前面的!$.cookie('countSecond') == "识别为一体,把&&后面的!$.cookie('countSecond')识别为一体,然后做的判断。
这个识别规则不统一啊?有人知道为啥吗?
这是我js文件里原来的写法:
if (!$.cookie('countSecond') == ""&&!$.cookie('countSecond') == "null")
F12测试的时候发现,
$.cookie('countSecond')=“2”,
$.cookie('countSecond') == ""为false,
!$.cookie('countSecond') == "" 为true
&&
$.cookie('countSecond') == "null"为false
!$.cookie('countSecond') == "null"也为false
后来改成了如下,就成功达到效果了
if (!($.cookie('countSecond') == "")&&!($.cookie('countSecond') == "null"))
$.cookie('countSecond')=“2”,
$.cookie('countSecond') == ""为false,
!($.cookie('countSecond') == "")为true