<button>click</button>
<script>
window.onload = function () {
var mas = [0, 1, 2, 3];
var len = mas.length ;
var num = 0;
var flag = true;
document.body.children[0].onclick = function () {
num++;
if (num > 3) {
num = 3;
}
if (flag == true) {
flag = false;
setTimeout(function () {
alert(mas[num]);
num = 0;
flag = true;
}, 400);
}
}
}
</script>