console
function repeat(func, time, wait) {
let counter = 0;
const intervalId = setInterval(() => {
func;
counter += 1;
console.log(counter)
if (counter === time) {
console.log('Done');
clearInterval(intervalId);
}
}, time * 1000)
}
function hhh(words) {
console.log(words)
}
function repeatedFunc(word) {
var words = word
repeat(hhh(words), 4, 1000)
}
var N = []
N[0] = document.getElementById(1)
N[1] = document.getElementById(2)
N[2] = document.getElementById(3)
N[3] = document.getElementById(4)
N[4] = document.getElementById(5)
function setColor(){
for(let i = 0; i<5;i++){
N[i].onclick = function(){
for(let j = 0;j<=i;j++){
console.log(j)
N[j].style.color = 'yellow'
}
for(let r = i+1;r<5;r++){
N[r].style.color = 'rgb(201, 201, 201)'
}
}
}
}
setColor()
<div class="cnm">
<div class="hh" id="1">★</div>
<div class="hh" id="2">★</div>
<div class="hh" id="3">★</div>
<div class="hh" id="4">★</div>
<div class="hh" id="5">★</div>
</div>
.hh {
display: block;
margin: 0 auto;
width: 20px;
height: 20px;
color: rgb(201, 201, 201);
}
.cnm {
display: flex;
justify-content: center;
text-align: center;
}