A responsive Javascript Coding Quiz.
- HTML - for base structure
- CSS - stying of html
- Javascript - for logic and functionallity purposes (local storage usage)
This website's functionality will start after the start button is tapped or clicked. The game will start with a running timer, there are 6 questions to answer, all multiple choices, one is correct. When a correct answer is chosen, the timer contoniues to run as normal, but when wrong answer is chosen, user will notice timer to lose seconds. User will lose wither by finishing questions, or by losing time. After game is over, user ca store their name an score in their local storage. This project uses a lot of DOM manipulation of HTML elements. The website is also built and designed to be mobile responsive.
function gameStart() {
timeLeft = 100;
timerElement.innerHTML = timeLeft;
timer = setInterval(function() {
timeLeft--;
timerElement.innerHTML = timeLeft;
// Run endgame function when timer equals 0
if (timeLeft <= 0) {
clearInterval(timer);
gameEnd()
}
}, 1000);
loop()
}
- W3 Schools