aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/javascript/reference/global_objects/array/tosource/index.html
blob: e503b9c617815d3aa08c3c6f8f7d9e8fb421879e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
title: Array.prototype.toSource()
slug: Web/JavaScript/Reference/Global_Objects/Array/toSource
tags:
  - Array
  - JavaScript
  - Method
  - Non-standard
  - Prototype
  - Reference
translation_of: Web/JavaScript/Reference/Global_Objects/Array/toSource
---
<div>{{JSRef}} {{non-standard_header}}</div>

<p><code><strong>toSource()</strong></code> 메서드는 해당 배열의 소스 코드를 문자열로 반환합니다.</p>

<h2 id="구문">구문</h2>

<pre class="syntaxbox"><var>arr</var>.toSource()</pre>

<h3 id="반환_값">반환 값</h3>

<p>배열의 소스 코드를 나타내는 문자열을 반환합니다.</p>

<h2 id="설명">설명</h2>

<p><code>toSource</code> 메서드는 다음의 값을 반환합니다.</p>

<ul>
 <li>내장 된 {{jsxref("Array")}} 객체의 경우에는 <code>toSource</code>는 소스 코드를 사용할 수 없음을 나타내며 다음의 문자열을 반환합니다.

  <pre class="brush: js">function Array() {
    [native code]
}
</pre>
 </li>
 <li>{{jsxref("Array")}} 인스턴스의 경우에는<code>toSource</code>는 소스 코드를 나타내는 문자열을 반환합니다.</li>
</ul>

<p>이 메서드는 보통 코드에 명시되지 않고 자바스크립트 내부적으로 호출됩니다. 디버깅을 위해 <code>toSource</code>를 호출하여 배열의 내용을 검사할 수 있습니다.</p>

<h2 id="예제">예제</h2>

<h3 id="배열의_소스_코드_검사하기">배열의 소스 코드 검사하기</h3>

<p>다음 코드는 배열의 소스 코드 문자열을 생성합니다.</p>

<pre class="brush: js">var alpha = new Array('a', 'b', 'c');

alpha.toSource();
//returns ['a', 'b', 'c']
</pre>

<h2 id="명세">명세</h2>

<p>Not part of any standard. Implemented in JavaScript 1.3.</p>

<h2 id="브라우저_호환성">브라우저 호환성</h2>

<div>


<p>{{Compat("javascript.builtins.Array.toSource")}}</p>
</div>

<h2 id="같이_보기">같이 보기</h2>

<ul>
 <li>{{jsxref("Object.prototype.toSource()")}}</li>
 <li>{{jsxref("Array.prototype.toString()")}}</li>
</ul>