js every second code example

Example 1: jquery call function every second

setInterval(function(){ 
    //this code runs every second 
}, 1000);

Example 2: javascript setinterval

setInterval(function(){ 
	console.log("Oooo Yeaaa!");
}, 2000);//run this thang every 2 seconds

Example 3: js do every x seconds

window.setInterval(function() {
  // do stuff
}, 1000); // 1000 milliseconds (1 second)

Example 4: js every

[12, 5, 8, 130, 44].every(x => x >= 10); // false
[12, 54, 18, 130, 44].every(x => x >= 10); // true