• YES / NO
• ON / OFF
• TRUE / FALSE

## Boolean() 函数

```Boolean(10 > 9)        // returns true
```

```(10 > 9)              // also returns true
10 > 9                // also returns true
```

## 比较和条件

== 等于 if (day == "Monday")
> 大于 if (salary > 9000)
< 小于 if (age < 18)

```100

3.14

-15

"Hello"

"false"

7 + 1 + 3.14

5 < 6
```

## 没有“真实”的一切都是假的

```var x = 0;
Boolean(x);       // returns false
```

```var x = -0;
Boolean(x);       // returns false
```

```var x;
Boolean(x);       // returns false
```

null的布尔值是 false:

```var x = null;
Boolean(x);       // returns false
```

false 的布尔值是false:

```var x = false;
Boolean(x);       // returns false
```

NaN 的布尔值是 false:

```var x = 10 / "H";
Boolean(x);       // returns false
```

## 布尔值可以是对象

```var x = false;
var y = new Boolean(false);

// typeof x returns boolean
// typeof y returns object
```

```var x = false;
var y = new Boolean(false);

// (x == y) is true because x and y have equal values
```

```var x = false;
var y = new Boolean(false);

// (x === y) is false because x and y have different types
```

```var x = new Boolean(false);
var y = new Boolean(false);

// (x == y) is false because objects cannot be compared
```