Why is JavaScript called a "scripting language"? Why is JavaScript called a "scripting language"? javascript javascript

Why is JavaScript called a "scripting language"?


I think first two sentences from wikipedia are clear enough:

A scripting language, script language or extension language is a programming language that allows some control of a single or many software application(s). Languages chosen for scripting purposes are often much higher-level than the language used by the host application...

In this case, the application is the browser. And about compilation:

Scripts are often, but not always, interpreted from the source code or "semi-compiled" to bytecode which is interpreted, unlike the applications they are associated with, which are traditionally compiled to native machine code for the system on which they run

About 0 being equal to '', the coercion it is not necessarily achieved by a compiler; it's all about the JavaScript engine in runtime.

I feel sorry for taking everything from Wikipedia but it's so clear and I put it quoted

PS: I find worth to paste this too:

Many people view 'scripting' languages as inferior or somehow different than languages that haven't achieved popularity on the scripting scene. Ironically, these same languages were carefully chosen for scripting due to their quality and versatility.


You're partially right. A scripting language is basically a language that doesn't stand by itself; it "scripts" another application (in this case, the browser). I think what you're thinking of is an interpreted language. What that essentially means is that it isn't compiled (at least not in the traditional sense), it's "interpreted" from the source code. Your example actually has nothing to do with compilation. The type conversion from a string to an integer is done at runtime.


An update for 2017

"Scripting languages are a lot like obscenity. I can't define it, but I'll know it when I see it." - Larry Wall

For the purposes of this answer let's assume it to mean a language that:

  1. lacks some of the features of a "real" language (whatever that means) so is most useful as the "glue" between other components in the system, and
  2. is interpreted rather than compiled.

Javascript was indeed at one point considered a scripting language, with basic features to manipulate the DOM, perform form validation and make the Jesus dance. It was executed directly from source by an interpreter.

But JS has matured considerably over the last few years, with advanced features such as lambdas, classes (for better or worse), destructuring, iterators and modules that bring its capabilities on par with most other modern languages. No longer restricted to the browser, is it also commonly found running standalone on the server under NodeJS.

Javascript is now universally JIT compiled, either to bytecode (like Java and C#), or directly to machine code (like C and C++). And modern engines offer an optimization phase, similar to most traditional compiled languages.

V8 (Chrome, Node)

V8 compiles JavaScript directly to native machine code before executing it.

Chakra Code (Edge)

Chakra Core [can] do parallel JIT compilation...

SpiderMonkey (Firefox)

SpiderMonkey 38 includes a just-in-time compiler (JIT) that compiles JavaScript to machine code...

Therefore, if modern JS is considered a scripting language then the same should apply to most other non-"scripting" languages.