javascript - what do these lines of code mean -
function nxt() { if( lights < imglen-1 ) { lights++; } else { lights=0; } imgelement.src = img[lights]; }
i have researched code still don't know means, can me explaining each line of code does/means thankyou can please explain means
when saw question, seems beginner. don't know know programming, should try study basics.
in other hand, have said understand. :p
function nxt() // create new function. nxt mean "next" { // delimite start of function if(lights < imglen-1) // if value of lights under value of imglen - 1 { lights++; // add 1 value of lights } else{ // otherwise lights=0; // set value of lights 0 } imgelement.src = img[lights]; // finally, assign imgelement img adress img @ pos of value of lights }
Comments
Post a Comment