how to print index value in if statement in javascript code example Example: javascript for loop var i; for (i = 0; i < 10 ; i++) { //do something }