What does the double exclamation !! operator mean? [duplicate]

The !! ensures the resulting type is a boolean (true or false).

javascript:alert("foo") –> foo

javascript:alert(!"foo") –> false

javascript:alert(!!"foo") –> true

javascript:alert(!!null) –> false

They do this to make sure $('row') isn’t null.

It’s shorter to type than $('row') != null ? true : false.

Leave a Comment