Is there any way to see the declaration of JavaScript native code? Whenever I try to look at a native function in Chrome or Firefox, it says "native code
":
> String.fromCharCode function fromCharCode() { [native code] }
What does this mean, and is there any tool which can help me to read actual code?
The native prototype is a JavaScript property that all built-in constructor functions in JavaScript use to inherit methods and properties from one another.
The reason Chrome or Firefox says that the code is native is that it really is native - the WebKit and Firefox developers have coded up that functionality in C or C++, not JavaScript. However, if you want to see the actual code, you can look at the source repositories for Chromium and Firefox.
Not within the JavaScript environment, but you can view the source for the open-source implementations.
Google V8: http://code.google.com/p/v8/source/browse
Mozilla SpiderMonkey: https://developer.mozilla.org/en/SpiderMonkey
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With