jquery - Can javascript for loop starts from negative number? -
here standard for
loop:
for (i=0; i<=5; i++) { el.append('<span>' + + '</span>'); }
this should append 11 spans text -5 5, doesn't work @ all...
for (i=-5; i<=5; i++) { el.append('<span>' + + '</span>'); }
is possible start i = -5
, example?
during creating fiddle found misspell... i+= -5
sorry wasting time :(
yes, it's possible, , works fine.
for (i=-5; i<=5; i++) { ... }
is same thing as
i=-5; while (i<=5) { ... } continue { i++ }
the point expression allowed inside for
's first part.
Comments
Post a Comment