Node.js Object.keys返回节点4.2.2中的对象。我需要一个数组

Node.js Object.keys返回节点4.2.2中的对象。我需要一个数组,node.js,Node.js,在节点repl Object.keys中,返回一个键数组似乎工作正常 > Object.keys({id: 1}) [ 'id' ] 但是像include这样的数组函数不起作用 > Object.keys({id: 1}).includes('id') TypeError: Object.keys(...).includes is not a function at repl:1:22 at REPLServer.defaultEval (repl.js:248:2

在节点repl Object.keys中,返回一个键数组似乎工作正常

> Object.keys({id: 1})
[ 'id' ]
但是像include这样的数组函数不起作用

> Object.keys({id: 1}).includes('id')
TypeError: Object.keys(...).includes is not a function
    at repl:1:22
    at REPLServer.defaultEval (repl.js:248:27)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:412:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
    at REPLServer.Interface._line (readline.js:549:8)
    at REPLServer.Interface._ttyWrite (readline.js:826:14)

有人知道为什么会这样吗?如何从Object.keys获取数组?

在节点
4.2.2
中可能无法使用
Array.includes
方法,它来自最新的标准。试试
indexOf
是的,就是这样。谢谢
> typeof(Object.keys({id: 1}))
'object'