SOURCE

console 命令行工具 X clear

                    
>
console
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
i = 0;
var t = setInterval('show()', 2000);
function show() {
  document.getElementById("hehe").innerHTML = arr[i];
  i = i + 1;
  //如果超过数组长度,清除定时器  
  if (i > arr.length - 1) {
    clearInterval(t)
  }
}
<div id="hehe">
</div>