tags:

views:

516

answers:

2

Programming languages are often classified by their structure. To date there are many types, including (but not limited to!): Procedural, Structured, Object-Oriented, Concurrent, Functional, Event-Driven, Compiled, and Interpreted (Source). Some programming languages are a mixture of these constructs, while others may fall under only one of the headings listed above.

My question is:

What type of language can JavaScript be classified as?

+27  A: 

The first line of the Javascript Wikipedia entry tells you.

JavaScript is a scripting language widely used for client-side web development. It was the originating dialect of the ECMAScript standard. It is a dynamic, weakly typed, prototype-based language with first-class functions.

Bill the Lizard
+1  A: 

Regarding your selection of Procedural, Structured, Object-Oriented, Concurrent, Functional, Event-Driven, Compiled, and Interpreted as "types" of a computer language, Javascript is quite powerful; it is at least (or can be) Procedural, Structured, Object-Oriented, Functional, Event-Driven and Interpreted.

However, as your source says, many languages do not fall into one category only, but can be used in different ways. Even for example Java could be used in a rather strict procedural way.

And although Javascript supports functional programming, it is not the lingua franca of functional programmers - but they could use it, if they wanted to.

Javascript is so versatile, because it is prototype-based and because you can pass functions as parameters to other functions, which really allows for some crazy programming techniques (read: HACKS) combined with dynamic creation of Javascript it can be really powerful and confusing as well :)

You might want to look up http://en.wikipedia.org/wiki/Prototype-based_programming for more explanations.

That was meant to be an 'example'. I added that edit, I also added this line that I think you missed: Some programming languages are a mixture of these constructs, while others may fall under only one of the headings listed above.
George Stocker
Yap, I don't see any problems with my answer though.