jQuery - how to write 'if not equal to' (opposite of ==)

后端 未结 4 1880
感情败类
感情败类 2021-02-06 21:54

I need to reverse of the following code. How can I make the animation run if the width is NOT 500px.

$(\".image-div\").not(this).each(function() {
        if ($         


        
相关标签:
4条回答
  • 2021-02-06 21:56
    !=
    

    For example,

    if ("apple" != "orange")
      // true, the string "apple" is not equal to the string "orange"
    

    Means not. See also the logical operators list. Also, when you see triple characters, it's a type sensitive comparison. (e.g. if (1 === '1') [not equal])

    0 讨论(0)
  • 2021-02-06 22:01

    == => !=

    === => !==

    Equal and its opposite

    0 讨论(0)
  • 2021-02-06 22:13
    if ("one" !== 1 )
    

    would evaluate as true, the string "one" is not equal to the number 1

    0 讨论(0)
  • 2021-02-06 22:21

    The opposite of the == compare operator is !=.

    0 讨论(0)
提交回复
热议问题