Alex Rivera | Logout

Is jQuery considered a language?

Asked 2010-11-17T06:16:02.850
13

I was just wondering if jQuery can be considered as a language, since it has its own syntax. I can't say it's a library, because most other languages are made through a library of another language. For example, PHP is written in C and PHP functions call functions made in C.

Just wanted to hear ideas and insights from all of you.

Edit
Report

1 Answer

16

It doesn't have its own syntax, it's simply plain JavaScript.

They implement a fluent interface pattern, that basically allows you to chain function calls, e.g.:

$(argument).method1().method2(); // etc...

$ is allowed to be used as an Identifier, that's why many libraries use it, not just jQuery.

In the above example, the $ identifier is in the context of a call expression, $(arguments) is just similar to myFunction(argument), that function call returns an object, that contains other properties that are by itself methods, that can be called subsequently as a "chain".

An example of a language built on top JavaScript (something slightly similar to your C => PHP example) would be CoffeeScript.

answered 2010-11-17T06:22:35.600

Your Answer