var arr = ["Brother Tao" , "Male" , 24, "College" , "University of Science and Technology Beijing" ];
for(var i=0;i<5;i ){
document .write(arr[i] "<br/>");
Every array element in variable arr does not meet the condition of i<5, why is it output?
郭官鹏2017-11-15 17:33:48
i represents the index value, which is arr[0], arr[1]...arr[5]. The 12345 in the square brackets is equivalent to i, which means which element!
帅帅的阿猪2017-10-26 09:38:10
The subscript of the array starts from 0, and the subscript of the University of Science and Technology Beijing is exactly 4, meeting the condition of less than 5
nearest2017-10-26 00:07:45
i<5 is the condition of the for loop. Specify five loops. This has nothing to do with variables
路过2017-10-25 08:50:52
are all satisfied! ! !
Did you not understand the meaning of the pointer?
arr = ["Brother Tao", "Male", 24, "College", "University of Science and Technology Beijing"];
arr If the pointer is not set, it starts from 0 by default.
arr[0] is equal to "Brother Tao" arr[4] is equal to "University of Science and Technology Beijing"
My foundation is very important. Take a look at the js manual