dapoadedire / digital-world-clock

Prefer var declarations be placed at the top of their scope JS-0102
Anti-pattern
Minor
4 occurrences in this check
All 'var' declarations must be at the top of the function scope
 6  clockContainer.classList.add("clock-container");
 7  mainContainer.appendChild(clockContainer);
 8  var timezone = document.createElement("h2");
 9  var clock = document.createElement("h2");10  timezone.className = "timezone";
11  clock.className = "clock";
12  clockContainer.appendChild(timezone);
All 'var' declarations must be at the top of the function scope
 5  var clockContainer = document.createElement("div");
 6  clockContainer.classList.add("clock-container");
 7  mainContainer.appendChild(clockContainer);
 8  var timezone = document.createElement("h2"); 9  var clock = document.createElement("h2");
10  timezone.className = "timezone";
11  clock.className = "clock";
All 'var' declarations must be at the top of the function scope
 2const mainContainer = document.querySelector(".container");
 3
 4for (var i = 0; i < timezones.length; i += 1) {
 5  var clockContainer = document.createElement("div"); 6  clockContainer.classList.add("clock-container");
 7  mainContainer.appendChild(clockContainer);
 8  var timezone = document.createElement("h2");
All 'var' declarations must be at the top of the function scope
 1import { timezones } from "./timezones.js";
 2const mainContainer = document.querySelector(".container");
 3
 4for (var i = 0; i < timezones.length; i += 1) { 5  var clockContainer = document.createElement("div");
 6  clockContainer.classList.add("clock-container");
 7  mainContainer.appendChild(clockContainer);