javascript - Uncaught SyntaxError: missing ) after argument list in loop -


i keep getting same error in code on line 21.

if(typeof jquery === undefined){     throw "jquery required sapphire work. didn't read     readme?"; } (function ( $ ) {  $.fn.slider = (function(options,images) {     var settings = $.extend({       slidecount: 4,       animationtype:"none",       slideduration:2000,       slidersize:1100,       looptimes:300000000000000000000000000000000000000000     },options);     for(var = 0; i<options.looptimes; i++){       var j = 0;       $("#sapphire-slide").append("<img src='"+images[j]+"'>");       settimeout(function() {         if(j<options.slidecount-1)           j++;          }else if(j===options.slidecount-1){            j=0;          }       },options.slideduration);     } );  })( jquery ); 

i not sure causing error, , looks fine syntax me. thanks!

you've got closing brace if in function you're passing settimeout:

if (j < options.slidecount - 1)       j++; // errant closing brace on next line: } else if(j === options.slidecount - 1) {    j = 0; } 

or, others have mentioned, add opening brace if make proper block:

if (j < options.slidecount - 1) {   // need opening brace       j++; } else if(j === options.slidecount - 1) {    j = 0; } 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -