Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

set timer

const prompt = require('prompt-sync')();
//You gotta download prompt-sync by doing npm i prompt-sync
var time = prompt("Give time in seconds: ")
time = parseInt(time)
setInterval(function(){
    console.log(time)
    if(time = 0){
        console.log("Time over")
    }
    else{
    time = time - 1}
}, 1000);
 
PREVIOUS NEXT
Tagged: #set #timer
ADD COMMENT
Topic
Name
1+4 =