1. findLast / findLastIndexfind() 는 앞에서부터 조건을 만족하는 첫 요소를 찾고,findLast() 는 뒤에서부터 찾는다. const numbers = [1, 2, 3, 4, 5, 6];console.log(numbers.find(n => n % 2 === 0)); // 2console.log(numbers.findLast(n => n % 2 === 0)); // 6console.log(numbers.findLastIndex(n => n % 2 === 0)); // 5 2. toSorted / toReversed / toSpliced / with원본 배열은 변경하지 않고, 새로운 배열을 반환한다.React 같이 불변성 유지가 중요한 프레임워크에서 유용히..
1. replaceAllreplace 는 첫번째 키워드만 바꿀 수 있지만replaceAll 은 문자열의 모든 키워드를 바꿀 수 있다.const str = "You are the best of the best";const str_1 = str.replaceAll('best', 'worst');// "You are the worst of the worst"const str_2 = str.replace('best', 'worst');// "You are the worst of the best" 문자열은 불변(immutable) 타입이기 떄문에 문자열 자체를 바꿀 수 없다.대신, replace() 같은 메서드로 원본을 직접 수정하지 않고, 새로운 문자열을 반환해 사용한다.이때, let 으로 선언한 문자열은 재..