How can I see how native js functions are implemented in a browser?
I've tried Math.floor.toString()
but it returns "function floor() { [native code] }"
and I can't step into the function using debugger.
How can I see how native js functions are implemented in a browser?
I've tried Math.floor.toString()
but it returns "function floor() { [native code] }"
and I can't step into the function using debugger.
You can't do this from the console, because the functions are part of the compiled browser executable … or, rather, its JavaScript engine. It is native code.
You may be able to read the source code for that engine, though, depending on which browser you're using. For example, Chrome's v8 source is on GitHub.
Updated
It's a native function. I'm guessing you could download the source code for a browser, as that's where it's implemented