250x250
Notice
Recent Posts
Recent Comments
- Today
- Total
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- flutter
- mongodb
- JavaScript
- til
- Find
- certbot
- nginx
- css
- double quote
- EC2
- mongoose
- RDS
- Node.js
- Nodejs
- wil
- atlas
- Express
- clipBehavior
- TypeScript
- AWS
- findByIdAndDelete
- await
- sequelize
- TailwindCSS
- https
- async
- MYSQL
- single quote
- moment
- jsonwebtoken
Link
Archives
기억 휘발 방지소
[JavaScript] shift()와 pop() 본문
728x90
반응형
📌 shift()
배열의 첫 번째 요소를 제거하고 반환한다.
const array = ["a", "b", "c"];
console.log(array.shift()); // a
빈 배열일 경우 undefined를 반환한다.
const array = [];
console.log(array.shift()); // undefined
📌 pop()
배열의 마지막 요소를 제거하고 반환한다.
const array = ["a", "b", "c"];
console.log(array.pop()); // c
shift()와 마찬가지로 빈 배열이면 undefined를 반환한다.
const array = [];
console.log(array.pop()); // undefined
728x90
반응형
'Web > JavaScript' 카테고리의 다른 글
자바스크립트의 async/await의 동작 이해하기 (0) | 2022.07.21 |
---|---|
[JavaScript] sort() (0) | 2021.10.02 |
[JavaScript] includes() (0) | 2021.09.25 |
[JavaScript] find() (0) | 2021.09.24 |
[JavaScript] reduce() (0) | 2021.09.11 |