array of elemts by class ts

Solutions on MaxInterview for array of elemts by class ts by the best coders in the world

showing results for - "array of elemts by class ts"
Desmond
10 Sep 2019
1const showSlides = () => {
2    const slides = document.getElementsByClassName('slide');
3
4    for (let i = 0; i < slides.length; i++) {
5        const slide = slides[i];
6
7        if (slide instanceof HTMLElement) {
8            // slide is a HTMLElement
9            slide.style.display = "none";
10        } else if (slide instanceof SVGElement) {
11            // slide is a SVGElement
12            const svgOwner = slide.ownerSVGElement;
13        } else {
14            // slide is a Element
15            const baseUri = slide.baseURI;
16        }
17    }
18};