> For the complete documentation index, see [llms.txt](https://leeboa.gitbook.io/study/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://leeboa.gitbook.io/study/undefined-13/undefined.md).

# 비교

## 비교

### 연산

```javascript
 a = 1 // 좌항에 있는 값을 우항에 대입함 = -> 대입연산자 
```

어떤 작업을 컴퓨터에게 지시하기 위한 기호

### 비교연산자&#x20;

```javascript
alert(1==2)             //false
alert(1==1)             //true
alert("one"=="two")     //false 
alert("one"=="one")     //true
```

#### ==

동등연산자 좌항과 우항을 비교해서 **서로 값이 같다면** true **다르다면** false<br>

#### ===

```javascript
alert(1=='1');              //true
alert(1==='1');             //false
```

* 일치 연산자로 **좌항과 우항이 '정확'하게 같을 때** true 다르면 false가 된다. (데이터형식까 일치)​
* **=== 를 사용하는것이 좋다** . ( 정확하기 때문에 )​

```javascript
alert(null == undefined);       //true
alert(null === undefined);      //false
alert(true == 1);               //true
alert(true === 1);              //false
alert(true == '1');             //true
alert(true === '1');            //false
alert(0 === -0);                //true
alert(NaN === NaN);             //false
```

* undefinded -> 프로그래밍이 의도하지 않은 상황
* null  -> 프로그래밍이 값이 없는상태를 의도한 상황&#x20;
* boolean ->  true / false &#x20;

### !=

```javascript
alert(1!=2);            //true
alert(1!=1);            //false
alert("one"!="two");    //true
alert("one"!="one");    //false
```

!== - > 정확하게 같지않을때 사용&#x20;

### > , > =&#x20;

\>  ->  좌항이 우항보다 크다면 참, 그렇지 않다면 거짓임을 알려주는 연산자

\> =  ->  좌항이 우항보다 크거나 같다.
