-2

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

enter image description here

Oghli
  • 2,200
  • 1
  • 15
  • 37

1 Answers1

6
  1. 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)
  2. 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
  • 1
    Any 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