javascript - js array traversal issues
欧阳克
欧阳克 2017-07-05 10:35:51
0
3
745

Does anyone know how to get the variable names in the array? For example, [a, b, c] wants to get the values ​​​​of a, b, c and a, b, c respectively by traversing.

欧阳克
欧阳克

温故而知新,可以为师矣。 博客:www.ouyangke.com

reply all(3)
曾经蜡笔没有小新
> arr=[]

> arr['a']=1

> arr['b']=2

> arr['c']=3

> for(k in arr)console.log(k,arr[k])
a 1
b 2
c 3

> arr
[ a: 1, b: 2, c: 3 ]
typecho

No.

学霸

for in ?

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