这个符号在 JavaScript 中是什么意思? [英] What does this symbol mean in JavaScript?
问题描述
这是不时出现的关于 JavaScript 语法的问题集合.这也是一个社区 Wiki,因此邀请所有人参与维护此列表.
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.
Stack Overflow 不允许搜索特定字符.因此,在搜索时不容易找到有关运算符和其他语法标记的许多问题.这也使得关闭重复项更加困难.下面的列表有助于解决这个问题.
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.
主要思想是在 Stack Overflow 上提供指向现有问题的链接,这样我们就可以更轻松地引用它们,而不是复制 ECMAScript 规范中的内容.
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.
此外,这是PHP 符号参考.我们需要一个 JS 的.
Additionally, this is a blatant copy of the PHP symbol reference. We needed a JS one.
请帮忙.编辑并添加指向其他运算符/语法参考的链接,或者如果您找不到有关特定语法的好问题/答案,请添加此问题的答案并将其链接
推荐答案
See the documentation on MDN about expressions and operators and statements.
- 目的是什么?、如何称呼?
- 为什么
(function(){…})();
可以工作,但function(){…}();
不是吗? (function(){…})();
vs(function(){...}());
- 更短的替代方案:
!function(){…}();
- 函数前的感叹号是做什么的?+function(){…}();
- JavaScript 函数表达式前的加号- !function(){ }() vs (function(){ })(),
!
vs 前导分号
- What is the purpose?, How is it called?
- Why does
(function(){…})();
work butfunction(){…}();
doesn't? (function(){…})();
vs(function(){…}());
- shorter alternatives:
!function(){…}();
- What does the exclamation mark do before the function?+function(){…}();
- JavaScript plus sign in front of function expression- !function(){ }() vs (function(){ })(),
!
vs leading semicolon
如果方括号出现在赋值语句的左侧 (
[a] = ...
),或者函数的参数内部,则它是一个 解构赋值.If the square brackets appear on the left side of an assignment (
[a] = ...
), or inside a function's parameters, it's a destructuring assignment.如果大括号出现在赋值的左侧 (
{ a } = ...
) 或函数的参数内,则它是 解构赋值.If the curly brackets appear on the left side of an assignment (
{ a } = ...
) or inside a function's parameters, it's a destructuring assignment.- What does this
`…${…}…`
code from the node docs mean? - Usage of the backtick character (`) in JavaScript?
- What is the purpose of template literals (backticks) following a function in ES6?
- 参数后的问号
- 空安全属性访问(和条件分配) 在 ES6/2015 中
- JavaScript 中的可选链
- 是否有javascript 中的空合并 (Elvis) 运算符或安全导航运算符?
- 是否存在空合并"?JavaScript 中的运算符?
(...rest) =>{}
— 函数定义中的...args"(三个点)是什么意思?fn(...args)
— foo(...arg)"是什么意思(三函数调用中的点)?[...iter]
— javascript es6 数组特性 [...data, 0] 扩展运算符"{...props}
— 带有三个点 (...) 的 Javascript 属性,在这个对象解构中...rest"代表什么?
(...rest) => {}
— What is the meaning of "…args" (three dots) in a function definition?fn(...args)
— What is the meaning of "foo(…arg)" (three dots in a function call)?[...iter]
— javascript es6 array feature […data, 0] "spread operator"{...props}
— Javascript Property with three dots (…), What does the '…rest' stand for in this object destructuring?
++someVariable
vssomeVariable++
in Javascript
- JavaScript 中 = +_ 的含义是什么、javascript中的单加运算符
- 一元加减运算符的重要用途是什么?
- 为什么是 [1,2]+ [3,4] = 1,23,4"在 JavaScript 中?
- 为什么 JavaScript 对字符串和数字之间的加减运算符的处理方式不同?
- 这些 JavaScript 按位运算符有什么作用?
- 如何: ~ 运算符?
- 是否有 &Javascript 中的逻辑运算符
- |"是什么意思?(单管道)在 JavaScript 中做什么?
- JavaScript 中的运算符 |= 有什么作用?
- JavaScript 中的 ^(脱字符号)有什么作用?
- 使用按位或 0 对数求底,在 JavaScript 中 x|0 如何对数字进行取整?
- 为什么
~1
等于-2
? - Javascript 中的~~(双波浪号")有什么作用?
- !!~(不是波浪号/bang bang 波浪号)如何改变包含/包含"数组方法调用的结果?(还有这里和此处)
- What do these JavaScript bitwise operators do?
- How to: The ~ operator?
- Is there a & logical operator in Javascript
- What does the "|" (single pipe) do in JavaScript?
- What does the operator |= do in JavaScript?
- What does the ^ (caret) symbol do in JavaScript?
- Using bitwise OR 0 to floor a number, How does x|0 floor the number in JavaScript?
- Why does
~1
equal-2
? - What does ~~ ("double tilde") do in Javascript?
- How does !!~ (not not tilde/bang bang tilde) alter the result of a 'contains/included' Array method call? (also here and here)
- JavaScript 中的逻辑运算符 - 您如何使用它们?
- 逻辑运算符 ||在javascript中,0代表布尔假?
- 什么是var FOO = FOO ||{}"(为该变量分配一个变量或一个空对象)在 Javascript 中是什么意思?, JavaScript OR (||) 变量赋值说明, 什么是构造 x = x ||你是什么意思?
- 赋值中的Javascript AND运算符
- 什么是x &&"foo()"?(还有这里和此处)
- 什么是!!(不是)JavaScript 中的运算符?
- 什么是 JavaScript 中的感叹号?
- Logical operators in JavaScript — how do you use them?
- Logical operator || in javascript, 0 stands for Boolean false?
- What does "var FOO = FOO || {}" (assign a variable or an empty object to that variable) mean in Javascript?, JavaScript OR (||) variable assignment explanation, What does the construct x = x || y mean?
- Javascript AND operator within assignment
- What is "x && foo()"? (also here and here)
- What is the !! (not not) operator in JavaScript?
- What is an exclamation point in JavaScript?
- ECMAScript 中的空合并运算符 (??) 与逻辑 OR 运算符 (||) 有何不同?
- 是否有javascript 中的空合并 (Elvis) 运算符或安全导航运算符?
- 是否存在空合并"?JavaScript 中的运算符?
x ** 2
等价于Math.pow(x, 2)
- 双星号 ** 是有效的 JavaScript 运算符吗?一个>
- MDN 文档
- 哪个等于运算符(== vs ===) 应该在 JavaScript 比较中使用吗?
- JS 类型强制是如何工作的?
- 在 Javascript 中,<整数值>==<整数值>"评估为真.为什么会这样?
- [] == ![] 计算结果为真
- 为什么未定义等于假"返回假?
- 为什么 !new Boolean(false) 在 JavaScript 中等于 false?
- Javascript 0 == '0'.解释这个例子
- 为什么假 == 假"是假的吗?
- What purpose do &&=, ||= and ??= serve?
- Replace a value if null or undefined in JavaScript
- Set a variable if undefined
- Ruby’s
||=
(or equals) in JavaScript? - Original proposal
- Specification
- 函数参数:从哪里可以获得有关 JavaScript 函数的对象参数语法的信息?
- 数组:javascript中的多重赋值?[a,b,c] = [1, 2, 3] 是什么意思?是什么意思?
- 对象/导入:赋值左侧的Javascript对象括号符号({导航} =)
- 使用let"和let"有什么区别?和var"?
- JavaScript 中有常量吗?
- 什么是时间死区?
var a, b;
— 在变量声明中使用的逗号(不要与逗号运算符混淆):JavaScript 变量定义:逗号与分号
- What's the difference between using "let" and "var"?
- Are there constants in JavaScript?
- What is the temporal dead zone?
var a, b;
— Comma used in variable declarations (not to be confused with the comma operator): JavaScript variable definition: Commas vs. Semicolons
- What does the
#
symbol do in JavaScript?
这篇关于这个符号在 JavaScript 中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!