function keys(h) { let i, a = []; for (i in h) a.push(i); return a; } function exampleUse() { const months = { jan: 31, feb: 28, mar: 31, apr: 30, may: 31, jun: 30, jul: 31, aug: 31, sep: 30, oct: 31, nov: 30, dec: 31 }; dump(keys(months)); }
Programming Tips - javaScript: How might I get the keys of a javaScript associative array?
Date: 2009jul24
Language: javaScript
Q. javaScript: How might I get the keys of a javaScript associative array?
A. This little function does the same thing as the perl keys() builtin function.