<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script>
var fired = 0;
var start = new Date();
var timer = setInterval(function(){
if(new Date() - start > 1000){
clearInterval(timer);
console.log(fired);
}
fired ++;
},0);
// console.log 大概是250 , 1000 / 250 = 4ms 就是说大概4ms 触发一次timmer
</script>
</body>
</html>