Changed around line 1
- document.addEventListener('DOMContentLoaded', function() {
- const calculateBtn = document.getElementById('calculate');
- const resultCard = document.getElementById('resultCard');
- const numbersAheadEl = document.getElementById('numbersAhead');
- const avgTimeEl = document.getElementById('avgTime');
- const estimatedTimeEl = document.getElementById('estimatedTime');
-
+ document.addEventListener("DOMContentLoaded", function () {
+ const calculateBtn = document.getElementById("calculate");
+ const resultCard = document.getElementById("resultCard");
+ const numbersAheadEl = document.getElementById("numbersAhead");
+ const avgTimeEl = document.getElementById("avgTime");
+ const estimatedTimeEl = document.getElementById("estimatedTime");
+
-
- calculateBtn.addEventListener('click', function() {
- const yourNumber = parseInt(document.getElementById('yourNumber').value);
- const currentNumber = parseInt(document.getElementById('currentNumber').value);
-
+
+ calculateBtn.addEventListener("click", function () {
+ const yourNumberInput = document.getElementById("yourNumber");
+ const currentNumberInput = document.getElementById("currentNumber");
+
+ const yourNumber = parseInt(yourNumberInput.value);
+ const currentNumber = parseInt(currentNumberInput.value);
+
- alert('Please enter valid numbers');
+ alert("Please enter valid numbers");
-
+
- alert('Your number cannot be less than the current number');
+ alert("Your number cannot be less than the current number");
-
+
- const avgTimePerPerson = baseTimePerPerson + (Math.random() * timeVariance);
+ const avgTimePerPerson = baseTimePerPerson + Math.random() * timeVariance;
-
+
-
+
- resultCard.classList.remove('hidden');
- numbersAheadEl.textContent = numbersAhead;
- avgTimeEl.textContent = `${avgTimePerPerson.toFixed(1)} mins`;
- estimatedTimeEl.textContent = formatTime(estimatedTime);
-
+ resultCard.classList.remove("hidden");
+ numbersAheadEl.textContent = `You have ${numbersAhead} numbers ahead of you`;
+ avgTimeEl.textContent = `Average time per person: ${avgTimePerPerson.toFixed(1)} mins`;
+ estimatedTimeEl.textContent = `Estimated wait time: ${formatTime(estimatedTime)}`;
+
- resultCard.style.animation = 'fadeIn 0.5s ease-out';
+ resultCard.style.animation = "fadeIn 0.5s ease-out";
-
+
- hour: '2-digit',
- minute: '2-digit'
+ hour: "2-digit",
+ minute: "2-digit",
-
+
- inputs.forEach(input => {
- input.addEventListener('input', function() {
+ inputs.forEach((input) => {
+ input.addEventListener("input", function () {