For instance, open up a JS console, and type toString<Enter>.
You'll get this:
function toString() { [native code] }
Contrast this with:
function foo() { return 'bar'; }
foo
which produces:
function foo() { return 'bar'; }
Does it mean that its an API to the interpreter which directly executes some internal routines in C or whatever is used to program it when that method is called?
asked Sep 5, 2012 at 16:42
wwaawaw
7,16710 gold badges36 silver badges42 bronze badges
-
1See stackoverflow.com/questions/787873/safari-native-codej08691– j086912012年09月05日 16:43:53 +00:00Commented Sep 5, 2012 at 16:43
-
It means the function is implemented by the browser.João Silva– João Silva2012年09月05日 16:44:27 +00:00Commented Sep 5, 2012 at 16:44
1 Answer 1
[native code] is simply a label that indicates that the implementation details of the function body are handled "natively" by the browser.
answered Sep 5, 2012 at 16:44
David G
97.6k41 gold badges173 silver badges258 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
wwaawaw
So in practice that would typically mean either something akin to the "shadow DOM" or compiled binary code?
Explore related questions
See similar questions with these tags.
lang-js