$ node > var a = {1: 'a', 2: 'b', 3: 'c'} undefined > a { '1': 'a', '2': 'b', '3': 'c' } > Object.keys(a)[0] '1' > typeof Object.keys(a)[0] 'string'
ちなみに Python だと数値のまま
$ ipython In [1]: a = {1: 'a', 2: 'b', 3: 'c'} In [2]: a Out[2]: {1: 'a', 2: 'b', 3: 'c'} In [3]: a.keys()[0] Out[3]: 1 In [4]: type(a.keys()[0]) Out[4]: int