Array.prototype.reverse

은비·2023년 7월 21일
1

JS_Array

목록 보기
14/20
post-thumbnail

Array.prototype.reverse

  1. 원본 배열의 순서를 반대로 뒤집는다.
  2. 원본 배열이 변경된다.
  3. 반환값은 변경된 배열이다.
const arr = [1, 2, 3];
const result = arr.reverse();

console.log(result); // -> [3, 2, 1]
console.log(arr); // -> [3, 2, 1] 

2개의 댓글

comment-user-thumbnail
2023년 7월 21일

정말 유용한 정보네요. Array.prototype.reverse 메소드에 대해 잘 알게 됐습니다. 감사합니다.

1개의 답글

관련 채용 정보