0
var obj = {
    a: "value",
    b: false
};
// nonexistent properties
console.log(!!obj.nonexistent);

// existing properties
console.log( !! obj.a);

i don't know the meaning of !!.

console.log(obj.nonexistent); -> undefined I can understand this. console.log(!obj.nonexistent); -> true i cann't understand this.?????????

console.log( !! obj.a); i cann't understand this.?????????

BlackMamba
  • 9,026
  • 6
  • 36
  • 58

1 Answers1

1

Consider, for example:

null  //null

then:

!null  //true

then:

!!null //false
sealocal
  • 6,810
  • 1
  • 31
  • 44