In the Node.js REPL, if you type String.prototype
, an empty object: {}
is returned. But if you type it in the Chrome JavaScript console, an object is returned with the expected function names and functions.
Why doesn't Node.js exhibit this behavior? How can I access the native String functions in Node.js?
According to the IRC users on FreeNode/#node.js
BennyLava: Object.getOwnPropertyNames(String.prototype)
jmar777: because in the REPL you basically get the result of calling
toString()
on the result, whereas the chrome console has some fancy interactive display of objectsBennyLava: they're just not enumerable
So the answer is Object.getOwnPropertyNames(String.prototype)
.
You could use node-inspector to get the Inspector experience for Node.