What is "~" represent in this JavaScript?

This question already has an answer here:

  • What does a tilde do when it precedes an expression? 6 answers

  • It's bitwise NOT : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators

    "take the result of the indexOf lookup, bitwise invert it, then take the logical NOT of that"

    链接地址: http://www.djcxy.com/p/75052.html

    上一篇: 如何检查URL是否包含给定的字符串?

    下一篇: 什么是“〜”代表这个JavaScript?