jQuery被认为是一种语言吗? [英] Is jQuery considered a language?

查看:96
本文介绍了jQuery被认为是一种语言吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道jQuery是否可以被视为一种语言,因为它有自己的语法。我不能说这是一个图书馆,因为大多数其他语言都是通过另一种语言库创建的。例如,PHP是用C和PHP函数编写的,用C语言调用函数。

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.

推荐答案

它没有自己的语法,只是简单的JavaScript。

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...

$ 是允许用作标识符,这就是许多库使用它的原因,而不仅仅是jQuery。

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

在上面的例子中, $ identifier位于调用表达式的上下文中, $(arguments) myFunction类似(参数),该函数调用返回一个对象,该对象包含其自身方法的其他属性,可以随后作为chain调用。

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".

基于JavaScript构建的语言示例(与 C => PHP 示例略有相似)将是 CoffeeScript

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

这篇关于jQuery被认为是一种语言吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆