[Javascript] Array.prototype.reverse()

reverse()

reverse() 메서드는 배열의 순서를 반전시키는 기능을 한다. 

 

반환 값

  • 순서가 반전된 배열

특징

  • 원본 배열을 변형한다.

 

예시

const array = ["one", "two", "three"];

const reversed = array.reverse();
console.log(reversed); // [ 'three', 'two', 'one' ]