[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Logical_NOT [Back]  [Original]

! - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

!

20157

! true false true

const a = 3;
const b = -2;

console.log(!(a > 0 || b > 0));
// Expected output: false

js
!expr

true false true

true false

false

  • null
  • NaN
  • 0
  • "" '' ``
  • undefined

! !! Boolean

!

js
!true; // !t returns false
!false; // !f returns true
!""; // !f returns true
!"Cat"; // !t returns false

!!

Boolean

js
!!true; // !!truthy returns true
!!{}; // !!truthy returns true: any object is truthy...
!!new Boolean(false); // ...even Boolean objects with a false .valueOf()!
!!false; // !!falsy returns false
!!""; // !!falsy returns false
!!Boolean(false); // !!falsy returns false

js
!!bCondition

js
bCondition

ECMAScript 2027 LanguageSpecification
# sec-logical-not-operator


Web Proxy Viewer  |  New URL  |  Original Page