Doubts about double exclamation (!!) in javascript / Jquery [duplicate]

5

I saw the use of the same in the source code of Jquery , for example:

fired: function() {
    return !!fired;
}

Code snippet located between lines 3222 and 3224 of version 2.1.4 uncompressed.

  • Is it something native to Javascript or created between the features of Jquery itself ?
  • Can be found in other languages, if so which ones?

NOTE: I would like an example of the usage in the response.

Reformulated question after discussion of the goal.

    
asked by anonymous 19.10.2015 / 14:30

1 answer

6

This does not belong to jQuery, this is JavaScript itself. When you deny something twice, you are converting the value to true, try typing in your console:! 'Hello World', and hit 'enter', then try this: !! 'Hello World'; Then try this: !![]+!![]

    
19.10.2015 / 14:36