EN
JavaScript - get list of associative array keys
0 points
In this article, we would like to show you how to get the list of associative array keys using JavaScript.
In this example, we use keys()
method to get the list of associative array keys.
xxxxxxxxxx
1
var dictionary = {
2
key1: [1, 2, 3],
3
key2: [4, 5, 6]
4
};
5
6
var keys = Object.keys(dictionary); // gets the keys
7
8
console.log(keys); // [ 'key1', 'key2' ]