Is there any way to see the native code of javascript build-in functions in browser console so I can Know the algorithm efficiency of the function and how it actually works
Asked
Active
Viewed 3,391 times
-2
-
1https://cs.chromium.org/ chromium code – sumeet kumar Nov 22 '17 at 19:34
-
1Check here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice – Vipin Kumar Nov 22 '17 at 19:48
-
1@VipinKumar is the source code is written in c++ language – Oghli Nov 22 '17 at 19:59
1 Answers
6
- Ensure you are using an open source browser (or get a job where you get access to the source code of the browser you are using)
- Look through that source code of that browser
Native code is program source code that has been compiled to native machine code. The source code isn't on your system unless you get it from some other source. It certainly isn't available to JavaScript.

Quentin
- 914,110
- 126
- 1,211
- 1,335
-
Thanks for info. Are they coded up functions native code in C or C++ also why not in javascript ? – Oghli Nov 22 '17 at 20:05
-
1Any native code is generally going to be in C/C++ or some other systems language for the simple reason of [performance](https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=node&lang2=gpp). At a theoretical level, interpreted languages must, at some point, be executed via a compiled language. JavaScript can technically be compiled, but is generally interpreted for safety reasons (though some engines compile certain portions that are considered safe). – vox Nov 22 '17 at 22:24