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?
-
1Likely they mean JavaScript, rather than JS libraries like jQuery, Dojo and others.p.campbell– p.campbell2011年08月11日 07:02:19 +00:00Commented Aug 11, 2011 at 7:02
-
I agree with @p.campbell. It’s the Javascript that browsers understand by themselves, natively. For jQuery lines, browsers need an ‘interpreter’, the jQuery file in the head section. Otherwise they will throw errors.Frank Conijn - Support Ukraine– Frank Conijn - Support Ukraine2022年07月28日 12:21:27 +00:00Commented Jul 28, 2022 at 12:21
9 Answers 9
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, andButton. 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.
1 Comment
Native JS, I think, it's example below:
$=~[];$={___:++,ドル$$$$:(![]+"")[$],__$:++,ドル$_$_:(![]+"")[$],_$_:++,ドル$_$$:
({}+"")[$],$$_$:($[$]+"")[$],_$$:++,ドル$$$_:(!""+"")[$],$__:++,ドル$_$:
++,ドル$$__:({}+"")[$],$$_:++,ドル$$$:++,ドル$___:++,ドル$__$:++$};$.$_=
($.$_=$+"")[$.$_$]+($._$=$.$_[$.__$])+($.$$=($.$+"")[$.__$])+
((!$)+"")[$._$$]+($.__=$.$_[$.$$_])+($.$=(!""+"")[$.__$])+
($._=(!""+"")[$._$_])+$.$_[$.$_$]+$.__+$._$+$.$;$.$$=$.$+
(!""+"")[$._$$]+$.__+$._+$.$+$.$$;$.$=($.___)[$.$_][$.$_];
$.$($.$($.$$+"\""+$.$$_$+$._$+$.$$__+$._+"\\"+$.__$+$.$_$+$.$_$+
$.$$$_+"\\"+$.__$+$.$_$+$.$$_+$.__+".\\"+$.__$+$.$$_+$.$$$+
"\\"+$.__$+$.$$_+$._$_+"\\"+$.__$+$.$_$+$.__$+$.__+$.$$$_+
"(\\\"\\"+$.__$+$.__$+$.___+$.$$$_+(![]+"")[$._$_]+(![]+"")[$._$_]+
$._$+", \\"+$.__$+$.$$_+$.$$$+$._$+"\\"+$.__$+$.$$_+$._$_+
(![]+"")[$._$_]+$.$$_$+"!\\\")\\"+$.$$$+$._$$+"\"")())();
4 Comments
Native JavaScript is the JavaScript implemented in the browser.
Browser implementation is followed by ECMA standard and some extra method. For example, if you familiar with jQuery and want to select element by ID
$('#myId')
Native JavaScript will be
document.getElementById('myId')
Now, if you need to do some simple tasks. You might not or should not load a huge jQuery Library and execute all its functionality. Rather 10 lines of native Javascript will do the job instead of 5 lines of jQuery code
Comments
I belief native Javascript reveres to 'vanilla' javascript, so no jQuery, MooTools, etc. Just plain old javascript
Comments
Not to complicate things too much more as @Ray's answer is correct, but a new JavaScript framework for building mobile applications has emerged called NativeScript https://www.nativescript.org/ If not confusing enough, this framework allows you to write pure "vanilla" JavaScript, but call Native (iOS/Android/WindowsPhone) APIs.
It is almost like writing a "Native" app (think Objective-C/Java/C#) but using a single language (JavaScript) which is interpreted at run-time on the device.
I suspect as this library's popularity grows "Native JavaScript" may be used as a label to describe code using this framework (esp. since that's how I got to this question via Google)
Comments
Native JavaScript is all JavaScript code . Not any kind of framework codes. It's faster and loads in the browser. You can use for simple browser task, that does not require any database interface, or any back-end large computation work. Using framework makes codes larger and makes browser slow.
1 Comment
The only context I know for the term "native JavaScript" involves writing JavaScript objects and/or functions that are implemented by the JavaScript provider and not written in JavaScript itself. For example, many of the functions you call on the window object are implemented by the browser in its native language (C++ for Firefox/Mozilla, etc.). This might be what they mean...
They might also mean vanilla/pure JavaScript (without frameworks like jQuery or Prototype). Consider contacting them and asking for clarification.
1 Comment
It is the same, perhaps just wondering if you've done more than just jayesh etc.
Comments
No , Native Javascript to me means 3rd party js functions that can do things that regular js cant , kind of like the Java-JNI relationship . Google JNEXT and JSNI for more info.
Again , I do not know the real context of the question , If i were you , I'd ask for clarification.