섹션 17:JavaScript Arrays

Crucial! Important Nice to Have
Array Basics - Creating and Updating Concat, IndexOf  
Push & Pop Slice & Splice  
Shift & Unshift Multi Dimensional Arrays  

Introducing Arrays

 

data structure = data collection

 

 

 

 

코딩 연습 25: Lotto Numbers Exercise

 

 

 

Array Random Access

 

 

string은 바로 바로 수정이 불가능하지만

array는 바로 수정이 가능하다..

->

 

 

 

코딩 연습 26: Array Access Exercise

 

 

 

Push & Pop

 

developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

 

Array

The JavaScript Array class is a global object that is used in the construction of arrays; which are high-level, list-like objects.

developer.mozilla.org

 


 

 

 

string은 변수 지정할때를 빼고는 내용이 바뀌지 않는다.(그리고 지정할때에 순간에 대한 내용을 저장한다.)

 

 

 

Shift & Unshift

 

 

코딩 연습 27: Push/Pop/Shift/Unshift Practice

 

 

 

 

Concat, indexOf, includes & reverse

developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat

 

Array.prototype.concat()

The concat() method is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array.

developer.mozilla.org

developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes

 

Array.prototype.includes()

The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.

developer.mozilla.org

developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf

 

 

Array.prototype.indexOf()

The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.

developer.mozilla.org

developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse

 

Array.prototype.reverse()

The reverse() method reverses an array in place. The first array element becomes the last, and the last array element becomes the first.

developer.mozilla.org


 

 

indexOf는 만약 array에 똑같은 컨텐츠가 있으면 가장 앞에있는것만 인덱스해준다.

 

 

'TIL(today I learned)' 카테고리의 다른 글

2020-11-22 TIL  (0) 2020.11.22
2020-11-21 TIL  (0) 2020.11.21
2020-11-14&15 TIL  (0) 2020.11.15
2020-11-12 TIL  (0) 2020.11.12
2020-11-11 TIL  (0) 2020.11.11

+ Recent posts