I don't understand, please give me guidance.
自律者自由
自律者自由 2017-10-25 00:37:53
0
4
1308

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?

自律者自由
自律者自由

reply all(4)
郭官鹏

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!

0

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

nearest

i<5 is the condition of the for loop. Specify five loops. This has nothing to do with variables

路过

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template