0
Hi all, what should i do to repeat these 4 functions ?
2 Answers
0
Hello, I think there are many solutions,for example:
Using a for loop or a while loop.You can check that in the js courses.
With a for loop:
After line 2(so on line 3) you insert:
for (var i=0;i<4;i++){
***Your whole code***
}
I choose i<4,but the numbers depend of how many times you would like to repeat it.
Maybe also create a function(still starting line 3) that includes the for loop with your whole code and then call that function:
function turningsquare(){
for(var i=0;i<4;i++){
***Your code***
}
}
turningsquare();
And if you only want to call that function once in a while you don't need the for loop,only call your function.
I think that will work, but anyway refers to the for or while loop courses...hope it will help.
Have a good evening.
0
Here is an example based on your code.
https://code.sololearn.com/WvPeN2dHjKws/?ref=app
You donât need left, right, bottom, top. You can move the box just using left and top.