- Today
- Total
Notice
Recent Posts
Recent Comments
Link
목록기본개념 (1)
Act99 기술블로그
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/Gahse/btrrJaoLijU/e7Bhklx79eHKWRvTiVciz0/img.png)
*자바스크립트에서 유사배열과 배열의 차이는 무엇인가? 또한 유사배열의 각 요소를 수정하고 싶다면 어떤 과정을 거쳐야 하는가? 유사배열의 한 예시는 HTMLCollection Array 가 있다. 유사배열은 Array의 내장함수를 바로 사용할 수 없다. 때문에 배열의 프로토타입에서 forEach 등의 내장함수 메서드를 빌려오는 방법이 있다. 그것은 바로 call 과 apply 이다. 가장 흔하게 사용하는 것은 Array.from이 있다. let nodes = document.querySelectorAll('div'); // call 사용 Array.prototype.forEach.call(nodes, (el) => {console.log(el)}) // Array from 사용 Array.from(node..
개발팁저장소
2022. 1. 25. 21:48