General Question

hullcrush's avatar

How do I simply repeat a line of code 4x in Javascript?

Asked by hullcrush (14points) January 11th, 2018
2 responses
“Great Question” (1points)

I know it is something like a while true loop – the correct solution for the game is:

forward();
forward();
forward();
forward();

I am assuming that’s a command. What is an easy way to do this? Thanks!

Observing members: 0
Composing members: 0

Answers

funkdaddy's avatar

something like a for loop is pretty simple, and gives you a handy counter if needed.

for(var i = 0; i < 4; i++) {
forward();
}

Response moderated (Spam)

Answer this question

Login

or

Join

to answer.

Mobile | Desktop


Send Feedback   

`