skip to Main Content

Condition when a sequence of conditions within a Javascript forEach() method is not met

My IntersectionObserver uses a forEach method to call some functions if a condition is met per each item of an array: const sections = document.querySelectorAll("section") function removeHighlight(id) { someElementArray[id].classList.remove('highlight') } function addHighlight(id) { someElementArray[id].classList.add('highlight') } function onObserve(entries, observer) { entries.forEach((entry)…

VIEW QUESTION
Back To Top
Search