这个符号在JavaScript中意味着什么?

时间:2022-02-06 16:56:34

What is this?

This is a collection of questions that come up every now and then about syntax in JavaScript. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.

这是一个关于JavaScript语法的问题集合。这也是一个社区维基,所以每个人都被邀请来维护这个列表。

Why is this?

Stack Overflow does not allow searching for particular characters. As a consequence, many questions about operators and other syntax tokens are not found easily when searching for them. This also makes closing duplicates more difficult. The list below is to help with this issue.

堆栈溢出不允许搜索特定的字符。因此,在搜索操作符和其他语法标记时,不容易找到许多有关操作符和其他语法标记的问题。这也使得关闭副本更加困难。下面的列表将帮助解决这个问题。

The main idea is to have links to existing questions on Stack Overflow, so it's easier for us to reference them, not to copy over content from the ECMAScript Spec.

主要思想是在Stack Overflow上有对现有问题的链接,所以我们更容易引用它们,而不是从ECMAScript规范中复制内容。

Additionally, this is a blatant copy of the PHP symbol reference. We needed a JS one.

此外,这是PHP符号引用的公然拷贝。我们需要一个JS。


Please help. Edit and add links to other operators/syntax references, or if you can't find good questions/answers on a particular piece of syntax, add an answer to this question and link it

请帮助。编辑并添加到其他操作符/语法引用的链接,或者如果您在特定的语法上找不到好的问题/答案,请在这个问题上添加一个答案并链接它。

1 个解决方案

#1


112  

MDN reference on operators

MDN参考运营商

The List

==, === Equality Operators

= = = = =平等运营商


!=, !== Inequality Operators

=、! = =不平等


&&, ||, ! Logical Operators

& &,| |,!逻辑运算符


, Comma Operator

,逗号操作符


?…: Conditional (ternary) Operator

?…:条件(三元)操作符


|, &, ^, ~ Bitwise OR, AND, XOR & NOT operators

&,|,^ ~位,或者,XOR和运营商


<<, >>, >>> Bit shift operators

<<, >>, >>>位移位算子


+, - operators

+、-运营商


++, -- pre/post-increment/decrement operators

+ +,——pre / post-increment /递减运算符


void operator

空白符


var x = function() vs function x() Function Declaration Syntax

var x = function() vs函数x()函数声明语法。


=> Arrow function expression syntax

=>箭头函数表达式语法


(function(){...})() IIFE (Immediately Invoked Function Expression)

(function(){…})()IIFE(立即调用函数表达式)


[], Array() Array Notation

[]数组()数组表示法


$ in regex replace patterns: $$, $&, $`, $', $n

$ in regex替换模式:$$ $$ $$,$n。


{key: value} Object literal syntax:

{key: value}对象文字语法:


Destructuring:

解构:


Template literals:

模板文字:


function*, yield, yield* Generator functions:

函数*、良率、良率*生成器函数:


var, let, const Declaring variables:

var, let, const声明变量:


this Keyword:

关键字:


:: Bind operator:

::绑定运营商:


new operator

新的操作符


delete operator

删除操作符


label: Labels

标签:标签


+= Operator

+ =操作符


...args — Spread syntax

…arg游戏——传播语法

#1


112  

MDN reference on operators

MDN参考运营商

The List

==, === Equality Operators

= = = = =平等运营商


!=, !== Inequality Operators

=、! = =不平等


&&, ||, ! Logical Operators

& &,| |,!逻辑运算符


, Comma Operator

,逗号操作符


?…: Conditional (ternary) Operator

?…:条件(三元)操作符


|, &, ^, ~ Bitwise OR, AND, XOR & NOT operators

&,|,^ ~位,或者,XOR和运营商


<<, >>, >>> Bit shift operators

<<, >>, >>>位移位算子


+, - operators

+、-运营商


++, -- pre/post-increment/decrement operators

+ +,——pre / post-increment /递减运算符


void operator

空白符


var x = function() vs function x() Function Declaration Syntax

var x = function() vs函数x()函数声明语法。


=> Arrow function expression syntax

=>箭头函数表达式语法


(function(){...})() IIFE (Immediately Invoked Function Expression)

(function(){…})()IIFE(立即调用函数表达式)


[], Array() Array Notation

[]数组()数组表示法


$ in regex replace patterns: $$, $&, $`, $', $n

$ in regex替换模式:$$ $$ $$,$n。


{key: value} Object literal syntax:

{key: value}对象文字语法:


Destructuring:

解构:


Template literals:

模板文字:


function*, yield, yield* Generator functions:

函数*、良率、良率*生成器函数:


var, let, const Declaring variables:

var, let, const声明变量:


this Keyword:

关键字:


:: Bind operator:

::绑定运营商:


new operator

新的操作符


delete operator

删除操作符


label: Labels

标签:标签


+= Operator

+ =操作符


...args — Spread syntax

…arg游戏——传播语法