• 코드:
​x
 
1
<!DOCTYPE html>
2
<html lang="ko">
3
​
4
<head>
5
    <meta charset="UTF-8">
6
    <title>JavaScript Object</title>
7
</head>
8
​
9
<body>
10
​
11
    <h1>객체의 메소드 참조</h1>
12
​
13
    <script>
14
        var person = {
15
            name: "홍길동",            // 이름 프로퍼티를 정의함.
16
            birthday: "030219",     // 생년월일 프로퍼티를 정의함.
17
            pId: "1234567",         // 개인 id 프로퍼티를 정의함.
18
            fullId: function() {
19
                return this.birthday + this.pId;
20
            }
21
        };
22
​
23
        document.write(person.fullId() + "<br>");   // 0302191234567
24
        document.write(person.fullId);              // function () { return this.birthday + this.pId; } 
25
    </script>
26
    
27
</body>
28
​
29
</html>