Need help


#1

var twos =0
var thees = 0
var counting - function(){
for (i =0; < 13; i ++) {
console.log(i);
}
while(twos < 13) {
console.log(twos);
twos + 2;
}
do {
console.log(threes);
threes + 3
} while (threes <13)
};


#2

Hey

I haven't run the code but you are missing a few things.

  • First, lines one and two should end with a semicolon ;

  • Line 3 should have an = not a -

  • In your for statement, it should read: for (i = 0; i < 13; i++)

Hope that helps, attention to detail is key!


#3

in addition to what @mobeale already mentioned (agreed on anything but the 3. one, what is the problem there?) first of all better use var before the first use of a variable. It might not be that important so far but without var you create global variables and by global it means global on any scope so for longer code you really wish that your variables are as local as possible so that you can keep track of them and not have to browse through lines and lines of code. And the second thing is that these statements will not work:

twos + 2;
threes + 3;

the problem is that they are just values but what you probably intended to do here, is to change the value by 2 or 3. Therefore you better use twos=twos+2; or the short version twos+=2;


#4

She has missed out the i variable in the second statement. (If you are allowed to omit this then my apologies :grinning:)


#5

Oh blind me... Of course your correct :smile: