How to iterate (keys, values) in javascript?

前端 未结 10 2728
孤街浪徒
孤街浪徒 2020-11-27 09:23

I have a dictionary that has the format of

dictionary = {0: {object}, 1:{object}, 2:{object}}

How can I iterate through this dictionary by

10条回答
  •  猫巷女王i
    2020-11-27 10:08

    You can use below script.

    var obj={1:"a",2:"b",c:"3"};
    for (var x=Object.keys(obj),i=0;i

    outputs
    1 a
    2 b
    c 3

提交回复
热议问题