IELTS Band Score Calculator

0.0
(function() { let btnCalculate = document.querySelector(“#btnCalculate”); let score = document.getElementById(“score”); let modules = { listening: { “9.0”: [39, 40], “8.5”: [37, 38], “8.0”: [35, 36], “7.5”: range(32, 34), “7.0”: [30, 31], “6.5”: range(26, 29), “6.0”: range(23, 25), “5.5”: range(18, 22), “5.0”: [16, 17], “4.5”: range(13, 15), “4.0”: range(10, 12), “3.5”: [8, 9], “3.0”: [6, 7], “2.5”: [4, 5], “0.0”: range(0, 4) }, reading: { “9”: [39, 40], “8.5”: [37, 38], “8”: [35, 36], “7.5”: [33, 34], “7”: range(30, 32), “6.5”: range(27, 29), “6”: range(23, 26), “5.5”: range(19, 22), “5”: range(15, 18), “4.5”: [13, 14], “4”: range(10, 12), “3.5”: [8, 9], “3”: [6, 7], “2.5”: [4, 5], “0”: range(0, 4) } }; function calculateScore() { let isReadingChecked = document.getElementById(“reading”).checked; let selectedModule = isReadingChecked ? “reading” : “listening”; let module = modules[selectedModule]; let correctAnswers = document.getElementById(“correctAnswers”).value; for (let band in module) { if (module[band].indexOf(parseInt(correctAnswers)) >= 0) { score.className += ” text-red-lightest”; score.innerText = parseFloat(band).toFixed(1); } } } btnCalculate.addEventListener(“click”, calculateScore); function range(start, end) { let result = []; for (let i = start; i < end + 1; i++) { result.push(i); } return result; } })();
error: