andsien andsien - 11 months ago 80
jQuery Question

Is jQuery considered a language?

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.

Answer Source

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.