class Carousel { constructor(el, imgSrc) { this.createCarousel(el, imgSrc); let max = imgSrc.length; this.max = max; } createCarousel(el, imgSrc) { const track = document.createElement("ul"); track.classList.add("carousel__track"); el.appendChild(track); for (let i = 0; i < imgSrc.length; i++) { const imageContainer = document.createElement("li"); imageContainer.classList.add("carousel__image-container"); const photo = document.createElement("img"); photo.classList.add("carousel__image"); photo.src = imgSrc[i]; imageContainer.appendChild(photo); track.appendChild(imageContainer); this.imageContainer = imageContainer; } //next button const nextButton = document.createElement("button"); nextButton.classList.add("carousel__next"); nextButton.addEventListener("click", this.next); el.appendChild(nextButton); } next() { if (true) { console.log(this.max); } } } createCarousel(el, imgSrc) { const track = document.createElement("ul"); track.classList.add("carousel__track"); el.appendChild(track); for (let i = 0; i < imgSrc.length; i++) { const imageContainer = document.createElement("li"); imageContainer.classList.add("carousel__image-container"); const photo = document.createElement("img"); photo.classList.add("carousel__image"); photo.src = imgSrc[i]; imageContainer.appendChild(photo); track.appendChild(imageContainer); this.imageContainer = imageContainer; } //next button const nextButton = document.createElement("button"); nextButton.classList.add("carousel__next"); nextButton.addEventListener("click", this.next); el.appendChild(nextButton); } next() { if (true) { console.log(this.max); } } }Necesito acceder a la variable máxima desde el constructor en el método de escucha de eventos de clic (siguiente). esto hará referencia al botón en sí. ¿Cómo accedo a las variables del constructor? también necesita acceder a la variable imageContainer (una donde se crearon los elementos) en el siguiente método, y poder agregarle/mofificar estilos