View Node.js String.prototype methods?

In Node.js REPL, if you type String.prototype , an empty object is returned: {} . But if you type it in the Chrome JavaScript console, the object will be returned with the expected function names and functions.

Why does Node.js not work? How can I access the built-in String functions in Node.js?

+2
source share
2 answers

According to IRC users on FreeNode / # node.js

BennyLava: Object.getOwnPropertyNames (String.prototype)

jmar777: because in REPL you basically get the result of calling toString() as a result, whereas the chrome console has some fancy interactive display of objects

BennyLava: They Just Are Not Listed

So the answer is Object.getOwnPropertyNames(String.prototype) .

+3
source

You can use the node-inspector to get the Inspector experience for Node.

node-inspector

0
source

Source: https://habr.com/ru/post/1232932/


All Articles