# 숫자와문자

## 숫자

### 수의 표현

```javascript
alert(1 + 1.1); // 더하기 
alert(1 * 38); // 곱하기
alert(6 / 2); // 나누기
​alert(6 - 2); // 빼기
```

### &#x20;수의 연산

```javascript
Math.pow(3,2); // 3의 2승 -> 0
Math.round(10.6); // 반올림 ->  11 
Math.ceil(10.2); // 11, 10.2를 올림
Math.floor(10.6); // 10,10.6을 내림
Math.sqrt(9); // 3, 3의 제곱근
Math.random(); // 0부터 1.0 사이의 랜덤한 숫자
```

## 문자

### &#x20;문자 표현

```javascript
	
alert("coding everybody");
alert('coding everybody'); 
alert("안녕하세요.\n 반갑습니다."); // \n 줄바
alert('egoing\'s javascript') // 문자를 해석하도록 강제함 이스케이
​
```

* 문자는 "큰따음표" 혹은 '작은따음표'중에 하나로 감싸야한다.
* **"큰따음표"  '작은따음표' 안에** **따음표를 넣고싶을때**는 **이스케이프**를 사용하면된다.&#x20;
* **​type of** 를 통해 **타입**을 확인해볼수 있다 (예: typeof 1 -> " number "  / typeof  "1" ->  string  )

### 문자 연산

```javascript
alert("coding" + "" +" hello")
console.log("code");
console.log("code".indexOf("e")); //3 
alert ("coding".length) // 6
```

* length 는 문자의 수를 출력&#x20;
* index of 는 index의 값을 출력해줌 ( c = 0 , o =1, d = 2 , e = 3 )


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://leeboa.gitbook.io/study/undefined-13/undefined-2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
