Delay in simon game

okay in simon game
i create array for colors

block=["red","blue","green","yellow"]

and i create another array

random_blocks=[]

and if the game start or the player check the colors right
i push another random color to it
and then i try simple way
just forEach(item) and for each item
item.css() change the css
then

setTimeout(function(),1000);

but it didn’t work
so i try this

for (var i =0;i<arr.length;i++){
   arr[i].css();
  setTimeout(function(),1000*(i+1));
}

also didn’t work
so i tried this

function the_loop(n){
  arr[i].css()//change the css
  setTimeout(function,1000);
}

and inside for loop
the_loop(i);
also didn’t work
and Promises also doesn’t work
all i need is just for every item in the array
change the css props to change the size and shape
wait second
and then back to the normal shape of the item
the page
is https://codepen.io/ayman-ayman/pen/mqzzwg

I’ve edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. Please also try to use proper grammar and sentences so we can understand you better. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

What do you want to accomplish anyway?
How do you think setTimeout function works?
How it can help you to do what you want to?

thank you but i finish this game thank god
but for you
the idea is very simple
i have array contain the four colors in the game
called blocks
and another array init as empty called random_blocks
when the game start i push to it one block in random way
then in the show function for every item in random_blocks
i make change on it and play the sound with it to make
the player know what blocks played before
ind that continues with push new random block if the player
remember right else the random_blocks will be the same length
for setTimeout
i need it for random_blocks
i need every item when i change his css to stay
for second so the player see it
but java script doesn’t have
wait or sleep function
so i used setTimeout for that
but it strange really
the first item alone stay one second all the others
no
but finally i solve it with help from thread here on the forum