--- 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 ---
toSource()
메서드는 해당 배열의 소스 코드를 문자열로 반환합니다.
arr.toSource()
배열의 소스 코드를 나타내는 문자열을 반환합니다.
toSource
메서드는 다음의 값을 반환합니다.
toSource
는 소스 코드를 사용할 수 없음을 나타내며 다음의 문자열을 반환합니다.
function Array() { [native code] }
toSource
는 소스 코드를 나타내는 문자열을 반환합니다.이 메서드는 보통 코드에 명시되지 않고 자바스크립트 내부적으로 호출됩니다. 디버깅을 위해 toSource
를 호출하여 배열의 내용을 검사할 수 있습니다.
다음 코드는 배열의 소스 코드 문자열을 생성합니다.
var alpha = new Array('a', 'b', 'c'); alpha.toSource(); //returns ['a', 'b', 'c']
Not part of any standard. Implemented in JavaScript 1.3.
{{Compat("javascript.builtins.Array.toSource")}}