function SpeacialArray() { // 배열을 생성합니다. var arr = new Array(); // 값을 추가 합니다. arr.push.apply(arr, arguments); // 메서드를 할당합니다. arr.toPipedString = function() { return this.join(" | "); }; return arr; } var colors = new SpeacialArray("red", "black", "sky"); // colors 객체에서 toPipedString 메서드를 사용할 수 있습니다. document.write(colors.toPipedString()); // red | black | sky