How javascript foreach works with multi-dimensional arrays?

后端 未结 3 1127
生来不讨喜
生来不讨喜 2021-02-09 17:58

I was playing a bit with javascript and found out (at least for me) strange behaviour when dealing with multi-dimensional arrays via a foreach loop. So I have this piece of code

3条回答
  •  醉梦人生
    2021-02-09 18:19

    for (... in ...) iterates over the properties of an object, not the elements of an array. w3schools, javascript garden

提交回复
热议问题