I came across a javascript program which was using !!
operator for comparision. I know !
stands for NOT EQUAL
. So logically !!
means NOT OF NOT EQUAL
which is EQUAL
.
if (!!var_1){
//...
}
My question is why do people sometimes use !!
and not ==
operator ?
I've read similar questions, but couldn't figure out when exactly do we use this.