Problem with the syntax [JavaScript]


#1

I've written a code to solve a problem, but the computer says: "SyntaxError: missing ) after argument list".
What's the problem?

My code:

for (var i = 100000000; i < 1000000000; i++) {
    var a = i.toString().substring(0; 1);
    var b = i.toString().substring(1; 2);
    var c = i.toString().substring(2; 3);
    var d = i.toString().substring(3; 4);
    var e = i.toString().substring(4; 5);
    var f = i.toString().substring(5; 6);
    var g = i.toString().substring(6; 7);
    var h = i.toString().substring(7; 8);
    var j = i.toString().substring(8; 9);
    if (a != b != c != d != e != f != g != h != j && b % 2 === 0 && (a + b + c) % 3 === 0 && (10 * c + d) % 4 === 0 && e % 5 === 0 && (d + e + f) % 3 === 0 && f % 2 === 0 && i.toString().substring(0; 7) % 7 === 0 && i.toString().substring(5; 8) % 8 === 0 && (a + b + c + d + e + f + g +h + j) % 9 === 0) {
        console.log(i)
    }
}

#2

slices with with substring are separated with comma (,), not semi-colon, so this:

.substring(0; 1);

has to become:

.substring(0, 1);

you can read about substring here


#3

Thank you! I've corrected that, but it still says "SyntaxError: missing ) after argument list".


#4

Here you go....

for (var i = 100000000; i < 1000000000; i++) {
var a = i.toString().substring(0, 1);
var b = i.toString().substring(1, 2);
var c = i.toString().substring(2, 3);
var d = i.toString().substring(3, 4);
var e = i.toString().substring(4, 5);
var f = i.toString().substring(5, 6);
var g = i.toString().substring(6, 7);
var h = i.toString().substring(7, 8);
var j = i.toString().substring(8, 9);
if (a != b != c != d != e != f != g != h != j && b % 2 === 0 && (a + b + c) % 3 === 0 && (10 * c + d) % 4 === 0 && e % 5 === 0 && (d + e + f) % 3 === 0 && f % 2 === 0 && i.toString().substring(0, 7) % 7 === 0 && i.toString().substring(5, 8) % 8 === 0 && (a + b + c + d + e + f + g +h + j) % 9 === 0) {
console.log(i)
}
}
@dobak2000


#5

well, i can't tell what you changed, if you need further help, post an updated version of your code