배열의 순서를 반전하는 메소드
const array1 = ['one', 'two', 'three'];
const reversed = array1.reverse(); //["three", "two", "one"]
'언어 정리 > JavaScript' 카테고리의 다른 글
Array.prototype.splice(), Array.prototype.slice() 배열을 자르는 메서드 (0) | 2022.11.29 |
---|---|
Array.prototype.fill() 특정 값으로 배열을 채움 (0) | 2022.11.29 |
Set() 배열에서 중복을 제거해주는 메서드 (0) | 2022.11.28 |
JS 메서드 Array.prototype.pop(),push(),unshift(),shift() (0) | 2022.11.23 |
indexOf(), lastIndexOf() - 배열에서 특정 값 index 찾기 (0) | 2022.11.23 |