티스토리 뷰

💼 정보 ver1.0

Array Object

James Wetzel 2010. 11. 30. 16:25

Array Object 선언
1] Type
var myCars=new Array(); // regular array (add an optional integer
myCars[0]="Saab";       // argument to control array's size)
myCars[1]="Volvo";
myCars[2]="BMW";
2] Type
var myCars=new Array("Saab","Volvo","BMW"); // condensed array
3] Type
var myCars=["Saab","Volvo","BMW"]; // literal array

내용 출력
document.write(myCars[0]);

내용 수정
myCars[0]="Opel";

Array Object Methods
concat()     Joins two or more arrays, and returns a copy of the joined arrays
join()         Joins all elements of an array into a string(특정 문자를 삽입하여 배열요소를 연결할 수 있다.)
pop()         Removes the last element of an array, and returns that element
shift()        Removes the first element of an array, and returns that element (pop()의 반대 역확)

참조 사이트 : http://www.w3schools.com/jsref/jsref_obj_array.asp




반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함