Christopher Posted October 4, 2013 Share Posted October 4, 2013 Ch6, P198, at the bottom of the page: for (var i = 0; i < myList.length; i++) {// Do something with myList.}The first time the loop is encountered, the i variable is set to 0: the first possibleindexed position. The condition then checks if i is less than the length propertyof the array. While that condition is TRUE, the loop’s body can do something withmyList: myList[0], myList[1], and so forth. Then i is incremented. Once iequals the length of the array, the loop is terminated, as there is no element indexedat myList[length]. "as there is no element indexed at myList[length]." I think a more accurate description would be "as there is no element indexed at myList[myList.length]." Link to comment Share on other sites More sharing options...
Larry Posted October 4, 2013 Share Posted October 4, 2013 Sure. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts