Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
167
rated 0 times [  170] [ 3]  / answers: 1 / hits: 66297  / 13 Years ago, thu, august 11, 2011, 12:00:00

Is there anything called Native JavaScript? I have seen this term in a job description I am going to be interviewing.



Is regular JavaScript is same as Native JavaScript?


More From » javascript

 Answers
43

The term native is very overused in JavaScript.




  • Colloquially, it is used as in Johan's answer: no JQuery, Moo, Dojo.


  • Analogous to the JNI for Java, Google's GWT and similar I-compile-down-to-JavaScript talks about the underlying implementation as being native.


  • The original use of native in JS, I believe, refers to objects built and defined in ECMAScript as opposed to the environment. JavaScript, as an ECMAScript language, is not intended to be self-sufficient; it is embedded in a host environment such as a Web browser, Photoshop, Acroread, etc. When you write a web client program, you will use objects such as Math, Function, Array, Window, and Button. The first three are native (independent of host environment), while the last two are non-native (supplied by the host environment). This is kind of the opposite of cdhowie's answer, which is a good answer BTW. Just interesting, though!




I'm sure there are other interpretations. My guess is that if you see this in a job description, it's probably not the last one: that definition is too academic. :)



Here is the official definition from the ECMAScript-262 Standard, Fifth Edition:



4.3.6 native object --- object in an ECMAScript implementation 
whose semantics are fully defined by this specification rather
than by the host environment. NOTE Standard native objects are
defined in this specification. Some native objects are built-in;
others may be constructed during the course of execution of an
ECMAScript program.


In other words the built-ins like Math, Object, String, RegExp are native, as are any objects I make with object literals or function definitions. But host objects are the opposite. Sorry for the ramble.


[#90688] Tuesday, August 9, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aidanl

Total Points: 156
Total Questions: 102
Total Answers: 112

Location: Saint Lucia
Member since Wed, Feb 8, 2023
1 Year ago
;