Javascript equivalent of Python iterkeys () method

In Python, I can use the iterkeys() method to iterate over the keys of a dictionary. For instance:

 mydict = {'a': [3,5,6,43,3,6,3,], 'b': [87,65,3,45,7,8], 'c': [34,57,8,9,9,2],} for k in mydict.iterkeys(): print k 

gives me:

 a c b 

How can I do something like this in javascript?

+4
source share
2 answers
 var mydict = { 'a': [3,5,6,43,3,6,3,], 'b': [87,65,3,45,7,8], 'c': [34,57,8,9,9,2], }; for (var key in mydict) { alert(key); } 
+4
source
 for(k in mydict){ alert(k) } 
0
source

Source: https://habr.com/ru/post/1303529/


All Articles