From 904466a779ccf2eb2f8921b5f90bb475ec95d7c5 Mon Sep 17 00:00:00 2001 From: bwbohl Date: Thu, 1 Dec 2022 00:58:29 +0100 Subject: [PATCH] Update carousel.js some ecma fixes as suggested by @musicEnfanthen --- js/carousel.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/js/carousel.js b/js/carousel.js index 7c64cc6f..68c3fbcb 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -13,20 +13,18 @@ * permissions and limitations under the License. */ -/*jslint browser:true*/ - -var intervals = []; +let intervals = []; /* * sets an interval timer for a submitted carousel - * @param {item} carousel - HTMLcolleciton item. + * @param {Object} carousel - HTMLElement. * @param {integer} milliseconds – the time per slide. */ function animateCarousel(carousel, milliseconds) { "use strict"; - var slides = carousel.getElementsByClassName("carousel-locator"), - slideIndex = 0, - id = carousel.id; + const slides = carousel.getElementsByClassName("carousel-locator"); + const id = carousel.id; + var slideIndex = 0; // iterate over slides intervals['i' + id] = setInterval(function () { // make slide at slideIndex visible @@ -43,6 +41,6 @@ function animateCarousel(carousel, milliseconds) { function stopCarouselAnimation(carousel) { "use strict"; - var id = carousel.id; + const id = carousel.id; clearInterval(intervals['i' + id]); }