# One-of-Each Looping Exercise Problem

#1

Hi, I am trying the three-loops exercise and this is not working:

I get:
SyntaxError: Expected ';'

``````    ```
for (z=1; z<11; z++) {
console.log ("Leonard Nimoy Lives!");
};

var stShows = ["TOS", "TNG", "DS9", "Voyager", "Enterprise"];
y=0;
while (y<stShows.length) {
console.log (stShows[y] + " " + "is the best Trek series!!!"; y++);
};

var Borg (0);
do {
console.log ("Look out for the Borg!");
while Borg(>0);
}
Borg();``````

`

#2

``````var Borg (0);
do {
console.log ("Look out for the Borg!");
while Borg(>0);
}
Borg();``````

You appear to have your syntax a little mixed up for your last bit of code. I assume this is supposed to be a function with a `do...while` loop inside.

The syntax for a function is like this:

``````var myFunction = function(foo) {
// Do something with foo
}

myFunction(someVariable);``````

And here is an example `do...while` loop:

``````do {
console.log("Hello");
x++;
}
while (x < 10);``````

So if you wanted to combine the two, it'd look something like this:

``````var myFunction = function(foo) {
do {
console.log("Hello");
foo++;
}
while(foo < 10);
}
myFunction(0);``````

#3

Thanks for your help. Shouldn't this work?

``````var borg = function (false) {
do {
console.log ("Look out for the Borg!");}
while (borg);
}
borg();``````

#4

That won't work because you're supplying a reserved keyword (`false`) as your function's parameter name:

`var borg = function (false) {`

It looks like you're trying to create a function with an infinite loop. If that's the case, bear in mind that statements will always validate as `true` unless stated otherwise, so you could just remove the `false` parameter from your function declaration and it would work.

I would also move the closing `}` of your `do` statement to a separate line so that it looks less confusing:

``````do {
console.log ("Look out for the Borg!");
} while (borg);``````

#5

Thanks very much. Finally saw what I was doing wrong.