22

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?

0

4 Answers 4

40

The Javascript Wikipedia entry tells you.

JavaScript (/ˈdʒɑːvəˌskrɪpt/), often abbreviated as JS, is a programming language that conforms to the ECMAScript specification. JavaScript is high-level, often just-in-time compiled, and multi-paradigm. It has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions.

Paragraph three goes on to say:

As a multi-paradigm language, JavaScript supports event-driven, functional, and imperative programming styles (emphasis added). It has application programming interfaces (APIs) for working with text, dates, regular expressions, standard data structures, and the Document Object Model (DOM).

Sign up to request clarification or add additional context in comments.

Comments

16

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.

3 Comments

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.
Yap, I don't see any problems with my answer though.
JavaScript FTW!
0

Mozilla Developer Network

...

JavaScript is a multi-paradigm, dynamic language with types and operators, standard built-in objects, and methods. Its syntax is based on the Java and C languages — many structures from those languages apply to JavaScript as well. JavaScript supports object-oriented programming with object prototypes, instead of classes (see more about prototypical inheritance and ES2015 classes). JavaScript also supports functional programming — functions are objects, giving functions the capacity to hold executable code and be passed around like any other object.

...

Comments

-5

JavaScript is an implementation of the ECMAScript language standard and is primarily used in the form of client-side JavaScript, implemented as part of a web browser in order to provide enhanced user interfaces and dynamic websites. This enables programmatic access to computational objects within a host environment.

1 Comment

This is plagiarized from some source (Google finds many, many variations of this paragraph), probably, without attribution and doesn’t answer the question adequately.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.