우주먼지 개발 log
javascript 메소드의 불변성 확인 사이트 : Does it mutate? 본문
반응형
javascript 메소드의 불변성을 확인해주는 사이트
Does it mutate?
The lastIndexOf() method returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex.Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
doesitmutate.xyz
mutate : 변형되다
객체나 리스트 내에 변형을 일으키는 메소드는 === 불변성을 유지해주지않는다고 말할 수 있다.
예를 들어 push는 불변성을 유지해주지 않는다.
map 이나 filter 메소드는 원본 배열을 바꾸지 않고 새로운 배열을 리턴하므로 불변성을 유지해준다.
반응형
'javascript' 카테고리의 다른 글
[javascript] formdata (0) | 2024.01.12 |
---|---|
[css] 애니메이션 @keyframes (0) | 2023.12.13 |
[javascript][배열 메소드] reduce() 이해하기 (0) | 2023.11.28 |
[javascript][css] border-radius / 메뉴모양 만들기 (0) | 2023.11.13 |
[javascript] 브라우저 기본 css style 초기화 : reset.css (0) | 2023.11.09 |