How to get the index value in for in. Give an example.

 var array={name:11111,age:18,xing:""}
       
        for(index,xd in array){
            // console.log(array[index])
            console.log(index)
            
        }
    
Jul.13,2021

your array is an object, and there is no index. It can't be accessed by index, it can only get Key.

.

if you want to get the KV value, just honestly use the method you commented out, and some suggestions

  

syntax is wrong. What is for (index in array) {.}
xd ? Why is there still ", "?
check the most basic questions before posting, which is completely careless.

Menu