Skip to content

Instantly share code, notes, and snippets.

View abdus's full-sized avatar

Abdus abdus

View GitHub Profile
// function for validating parameter
const validateParam = (param2validate) => {
if (!param2validate) return false;
if (param2validate.length === 0) return false;
if (typeof param2validate != 'string') return false;
};
const searchPhrase = (phrase, data) => {
if (validateParam(phrase) === false){
const countDownTimer = (totalTime) => {
let timeFunc = setInterval(() => {
console.log(totalTime);
totalTime--;
if (totalTime < 0) {
clearInterval(timeFunc);
console.log("Time's Up!");
}
}, 1000)
}