# 인덱스 바꾸기

## **문제 설명**

문자열 `my_string`과 정수 `num1`, `num2`가 매개변수로 주어질 때, `my_string`에서 인덱스 `num1`과 인덱스 `num2`에 해당하는 문자를 바꾼 문자열을 return 하도록 solution 함수를 완성해보세요.

***

**제한사항**

* 1 < `my_string`의 길이 < 100
* 0 ≤ `num1`, `num2` < `my_string`의 길이
* `my_string`은 소문자로 이루어져 있습니다.
* `num1` ≠ `num2`

***

**입출력 예**

| my\_string   | num1 | num2 | result       |
| ------------ | ---- | ---- | ------------ |
| "hello"      | 1    | 2    | "hlelo"      |
| "I love you" | 3    | 6    | "I l veoyou" |

***

**입출력 예 설명**

입출력 예 #1

* "hello"의 1번째 인덱스인 "e"와 2번째 인덱스인 "l"을 바꾸면 "hlelo"입니다.

입출력 예 #2

* "I love you"의 3번째 인덱스 "o"와 " "(공백)을 바꾸면 "I l veoyou"입니다.

## 코드

```javascript
function solution(my_string, num1, num2) {
    let strs = [...my_string];
    strs.splice(num1, 1, my_string[num2]);
    strs.splice(num2, 1, my_string[num1]);
    return strs.join('');
}
```


---

# 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://songeun.gitbook.io/coding-test/lv.0/79.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.
