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(function(a,b){return b - a}),"<br>");
document.write(arr10.sort(function(a,b){return a - b}),"<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>");102p 예제
103p 예제
Last updated
Was this helpful?