javascript - How can I quickly retrieve a value from a MapIterator returned from Object.keys function? -


i have variable rule_table map maps object string.

i want retrieve value keys of rule_table in chrome dev console.

if run

a = rule_table.keys() 

i mapiterator object.

enter image description here

however try either of these:

  • a[0]
  • a.get(0)

i fail retrieve value:

enter image description here

eventually convert list way

var keys = []; (var key of rule_table.keys()) {     keys.push(key); } 

my question is:

is there quicker way convert mapiterator list? how list() in python example?

chrome version: version 57.0.2987.133 (64-bit)

assuming using native map's , it's ok use es6, can use spread operator expand map.keys()

const keys = [...rule_table.keys()] 

Comments