setinterval javascript example
Example 1: javascript setinterval
setInterval(function(){
console.log("Oooo Yeaaa!");
}, 2000);
Example 2: setinterval javascript
setInterval(function(){
console.log("Hello");
console.log("World");
}, 2000);
Example 3: javascript setinterval
setInterval(function(){
console.log("print this once every 3 second");
}, 3000);
Example 4: javascript padstart
export function padStart(number, digits = 2, emptyDigit = 0) {
let length = 0;
let n = Math.abs(number);
let absoluteNumber = n;
do {
n /= 10;
length++;
} while (n >= 1);
const prefix = Array(Math.max((digits - length) + 1, 0)).join(emptyDigit);
return number < 0 ? `-${prefix}${absoluteNumber}` : prefix + number;
}
export default padStart;