Array 객체
매서
설
join()
배열 사이에 지정된 문자열을 추가하
reverse()
배열을 역순으로 정렬
sort()
배열 정리하
slice()
배열을 일부 선택하
concat()
배열을 합치
shift()
첫 번째 배열 가져오기 또는 제거하
unshift()
첫 번째 배열 추가하
pop()
마지막 배열 제거하
const arr10 = [100, 200, 300, 400, 500];
const arr20 = [600, 700, 800, 900, 1000];
document.write(arr10,"<br>");
document.write(arr10.join('*'),"<br>");
document.write(arr10.reverse(),"<br>");
document.write(arr10.sort(),"<br>");
document.write(arr10.sort(function(a,b){return b - a;}),"<br>");
document.write(arr10.slice(1,3),"<br>");
document.write(arr10.slice(2,3),"<br>");
document.write(arr10.concat(arr20),"<br>");
document.write(arr10.shift(),"<br>");
document.write(arr10,"<br>");
document.write(arr10.unshift(100),"<br>");
document.write(arr10,"<br>");
document.write(arr10.pop(),"<br>");
document.write(arr10,"<br>");
102, 103 예제 숙제
Last updated
Was this helpful?