if(-1!==className.indexof("imooc")) { $("this").addClass("imoocclass") }
if中的判断语句为什么要这样写?双重否定,有没有其他的写法?
-1!==className.indexof("imooc")
即classname中存在imooc
indexof('imooc')是查找classname中的imooc
如果imooc不存在 返回-1
所以不等于-1
即包含imooc
不错啊
没看懂