Array 객체
//Array 객체
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.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>"); //shift로 인해 100은 잘리고 200부터
document.write(arr10.unshift(100), "<br>");
document.write(arr10, "<br>");
document.write(arr10.pop(), "<br>");
document.write(arr10, "<br>");
//100,200,300,400,500
//100*200*300*400*500
//500,400,300,200,100
//100,200,300,400,500
//500,400,300,200,100
//100,200,300,400,500
//200,300
//300
//100,200,300,400,500,600,700,800,900,1000
//100
//200,300,400,500
//5
//100,200,300,400,500
//500
//100,200,300,400102페이지 예제
103페이지 예제
Last updated