samedi 30 juillet 2016

If / Else statement in a loop, javascript

Hi For some reason the console is returning to me SyntaxError: Unexpected token else, but I don't really know the problem, can someone help me please ?

lineN = ["Times Square", "34th", "28th", "23rd", "Union Square", "8th"];
storeStops = [];

 function input ( start, stop ){

    if (lineN.indexOf(start)<lineN.indexOf(stop)){
        for (var fwd =lineN.indexOf(start) ; fwd < lineN.indexOf(stop) ;foward++);
        fwd.push(storeStops);
    }}
    else {for (var bwd =lineN.indexOf(start) ; bwd < lineN.indexOf(stop) ;bwd--);
        bwd.push(storeStops)
    };

Aucun commentaire:

Enregistrer un commentaire