Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

adding a timer in a quiz game

var sec = 15;
var time = setInterval(myTimer, 1000);

function myTimer() {
    document.getElementById('timer').innerHTML = sec + "sec left";
    sec--;
    if (sec == -1) {
        clearInterval(time);
        alert("Time out!! :(");
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: react toggle state 
Javascript :: us postal code regex 
Javascript :: kick commands discord.js 
Javascript :: angular conditionally show tooltip 
Javascript :: python class json serializable 
Javascript :: how to watch for changes within a prop in vue 
Javascript :: right shift operator js 
Javascript :: mongoose number bigger 
Javascript :: how to check if a string is an integer javascript 
Javascript :: nodejs save blob file 
Javascript :: hex string to decimal string javascript 
Javascript :: reactjs firebase timestamp to date 
Javascript :: js in_array 
Javascript :: javascript ES6 Default Parameter Values 
Javascript :: change class of icon using jquery 
Javascript :: 7) Change cursor:pointer at checkboxes in java script 
Javascript :: react js http post 500 internal server error 
Javascript :: dropzone add download button addedfile 
Javascript :: how to put space in between characters javascript 
Javascript :: js timezone location 
Javascript :: how to send response to client in nodejs using res object 
Javascript :: radio button checked jquery 
Javascript :: link tag react 
Javascript :: react detect page width 
Javascript :: findone mongoose 
Javascript :: check a date is between two dates in javascript 
Javascript :: working with json in javascript 
Javascript :: how to install nuxtjs with tailwind css 
Javascript :: java script remove last charecter from the string 
Javascript :: get milliseconds since epoch for 12am today javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =