javascript - Variable "iii" declared as a counter in for loop not working -
tl;dr version: there reason variable name of "iii" wouldn't work expected when used counter in loop?
longer, funnier version: i'm writing javascript iterate through layers , pageitems in adobe illustrator cc 2014 , stuff them. in third nested loop, used variable named "iii" counter so:
for(var iii = 0; iii < curitem.pageitems.length -1; iii++){ //try stuff curitem.pageitems[iii], "undefined" }
i spent long while trying figure out wrong logic , kept coming nothing. went through colleague line-by-line, desperate, hoping (or i) might notice trivial might have overlooked (he's not of programmer understands bits , pieces). asks me why named counters "i", "ii", , "iii". said saw use "ii" nested loop , thought "that's kinda neat, it's short , communicates nesting level of loop!" tell him doesn't matter, "iii" valid variable name. convinces me humour him replace "iii" "p" , code proceeds work. change "iii" , fails. blink in shock @ amount of humble pie i'm going have eat years come inevitably bring @ every opportunity.
so yeah, missing here? make sense @ all? thanks!
Comments
Post a Comment