1. toString

toString(): string;

Returns a string representation of an array.

(배열의 문자열 표현을 반환합니다.)

const arrdata = ['a', 'b', 'c', 'd'];
const logdata = arrdata.toString();
// 결과
console.log(arrdata);               // ["a", "b", "c", "d"]
console.log(arrdata[0].toString()); // a
console.log(logdata);               // a,b,c,d
  1. toLocaleString

toLocaleString(): string;

Returns a string representation of an array. The elements are converted to string using their toLocalString methods.

(배열의 문자열 표현을 반환합니다. 요소는 toLocalString 메소드를 사용하여 문자열로 변환됩니다.)

const arrdata2 = [54321, 11223, 4212.332];
const logdata2 = arrdata2[0];
const logdata3 = arrdata2[2];
// 결과
console.log(logdata2);
console.log(logdata2.toLocaleString());        // 54,321
console.log(logdata3.toLocaleString());        // 4,212.332
console.log(logdata3.toLocaleString('de-DE')); // 4.212,332
  1. pop

pop(): T | undefined;

T : 항목 (여기선 배열안에 존재하는 항목 값)

Removes the last element from an array and returns it.

(배열에서 마지막 요소를 제거하고 반환합니다.)

If the array is empty, undefined is returned and the array is not modified.

(배열이 비어 있으면 undefined가 반환되고 배열이 수정되지 않습니다.)

const arrpop  = ['a', 'b', 'c']; //'a', 'b', 'c'
const arrpop2 = [];
// 결과1
arrpop.pop();
console.log(arrpop);       // ['a', 'b']
console.log(arrpop.pop()); // b
// 결과2
console.log(arrpop2);      // []
console.log(arrpop2.pop());// undefined
  1. push

push(...items: T[]): number;

T[] : 항목들 (배열 항목)

Appends new elements to the end of an array, and returns the new length of the array.

(배열 끝에 새 요소를 추가하고 배열의 새 길이를 반환합니다.)

@param items New elements to add to the array.

(@param items 는 배열에 추가 할 새 요소입니다.)

const arrpush = ['a', 'b', 'c'];
// 결과
arrpush.push('d','d');
console.log(arrpush);           // ['a', 'b', 'c', 'd', 'd']
console.log(arrpush.push('e')); // 6
  1. concat (1)

concat(...items: ConcatArray<T>[]): T[];

ConcatArray<T>[] : 배열 또는 배열들

Combines two or more arrays.

(둘 이상의 배열을 결합합니다.)

This method returns a new array without modifying any existing arrays.

(이 메서드는 기존 배열을 수정하지 않고 새 배열을 반환합니다.)

@param items Additional arrays and/or items to add to the end of the array.

(@param items 는 배열 끝에 추가 할 추가 배열 및 / 또는 항목입니다.)

const arrpop  = ['a'];
const arrpush = ['a', 'b', 'c', 'd', 'd', 'e'];
const arrconcat  = arrpop.concat(arrpush);
const arrconcat2 = arrpop.concat(arrpush, arrpush);
// 결과1
console.log(arrconcat);  // ['a', 'a', 'b', 'c', 'd', 'd', 'e']
// 결과2
console.log(arrconcat2); // ['a', 'a', 'b', 'c', 'd', 'd', 'e', 'a', 'b', 'c', 'd', 'd', 'e']
  1. concat (2)

concat(...items: (T | ConcatArray<T>)[]): T[];

T : 항목

ConcatArray<T>[] : 배열 또는 배열들

const arrconcatA = [1, 2, 3];
const arrconcat3 = arrconcatA.concat(21);
const arrconcat4 = arrconcatA.concat(21, 22, 23);
const arrconcat5 = arrconcatA.concat([21, 22, 23], 24); // --> concatArray 와 T
// 결과1
console.log(arrconcat3);  // [1, 2, 3, 21]
// 결과2
console.log(arrconcat4);  // [1, 2, 3, 21, 22, 23]
// 결과3
console.log(arrconcat5);  // [1, 2, 3, 21, 22, 23, 24]
  1. join

join(separator?: string): string;

Adds all the elements of an array into a string, separated by the specified separator string.

(배열의 모든 요소를 지정된 구분자 문자열로 구분 된 문자열에 추가합니다.)

@param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

(@param 구분자는 배열의 한 요소를 결과 문자열에서 다음 요소와 구분하는 데 사용되는 문자열입니다. 생략하면 배열 요소가 쉼표로 구분됩니다.)