# getUserName 메서드

#### 메서드 <a href="#getusername-fang-fa-fang-fa" id="getusername-fang-fa-fang-fa"></a>

page.getUserName()

#### 설명 <a href="#getusername-fang-fa-miao-shu" id="getusername-fang-fa-miao-shu"></a>

현재 로그인한 사용자의 사용자 이름을 가져오고 사용자가 로그인하지 않은 경우 null 값을 반환합니다.

#### **매개 변수**  <a href="#getusername-fang-fa-can-shu-shuo-ming" id="getusername-fang-fa-can-shu-shuo-ming"></a>

&#x20;  **없음**&#x20;

#### **반환값**  <a href="#getusername-fang-fa-fan-hui-zhi" id="getusername-fang-fa-fan-hui-zhi"></a>

string

#### 예제 <a href="#getusername-fang-fa-shi-li" id="getusername-fang-fa-shi-li"></a>

다음 예제 코드에서는 getUserName 메서드를 통해 사용자 이름을 가져옵니다.

```
// 현재 페이지 가져오기
var page = Forguncy.Page;
//현재 로그인한 사용자의 사용자 이름을 가져옵니다.
var userName = page.getUserName();
//현재 로그인한 사용자의 사용자 이름을 보여주는 경고 상자가 나타납니다.
alert(userName);
```

#### Forguncy 사용 예제

1. 페이지를 생성한 후 셀에 “현재 사용자” 셀 유형을 적용합니다.

<figure><img src="https://forguncy-korea.github.io/images/forguncy5/ex-ss_page-getusername01.png" alt=""><figcaption></figcaption></figure>

2\. 해당 페이지에 버튼을 생성하고, “자바스크립트로 직접 프로그래밍하기” 명령으로 코드를 입력합니다.<br>

<figure><img src="https://forguncy-korea.github.io/images/forguncy5/ex-ss_page-getusername02.png" alt=""><figcaption></figcaption></figure>

3\. 프로젝트를 실행하여 버튼을 누르면 getUserName을 화면에 표시합니다.

![](https://forguncy-korea.github.io/images/forguncy5/ex-ss_page-getusername03.gif)


---

# 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://doc.forguncy.co.kr/v7/command/javascriptprogramming/javascript-api/class/page/getusername.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.
