Skip to content

Commit dcd27d5

Browse files
committed
增加表达式和运算符分类
1 parent f801514 commit dcd27d5

1 file changed

Lines changed: 345 additions & 1 deletion

File tree

readme.md

Lines changed: 345 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6653,4 +6653,348 @@ document.getElementById('content').innerHTML = html;
66536653

66546654
```
66556655

6656-
![image-20200126152920878](readme.assets/image-20200126152920878.png)
6656+
![image-20200126152920878](readme.assets/image-20200126152920878.png)
6657+
6658+
6659+
6660+
# 表达式和运算符分类
6661+
6662+
左侧工具栏是按字母表排序的列表。
6663+
6664+
### 主要表达式
6665+
6666+
6667+
6668+
JavaScript中基本关键字和常用表达式。
6669+
6670+
- [`this`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/this)
6671+
6672+
`this` 关键字指向函数的执行上下文。
6673+
6674+
- [`function`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/function)
6675+
6676+
`function` 关键字定义了函数表达式。
6677+
6678+
- [`class`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/class)
6679+
6680+
`class` 关键字定义了类表达式。
6681+
6682+
- [`function*`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/function*)
6683+
6684+
`function*` 关键字定义了一个 generator 函数表达式。
6685+
6686+
- [`yield`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/yield)
6687+
6688+
暂停和恢复 generator 函数。
6689+
6690+
- [`yield*`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/yield*)
6691+
6692+
委派给另外一个generator函数或可迭代的对象。
6693+
6694+
- `async function`
6695+
6696+
`async function` 定义一个异步函数表达式。
6697+
6698+
- [`await`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/await)
6699+
6700+
暂停或恢复执行异步函数,并等待promise的resolve/reject回调。
6701+
6702+
- [`[\]`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array)
6703+
6704+
数组初始化/字面量语法。
6705+
6706+
- [`{}`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Object_initializer)
6707+
6708+
对象初始化/字面量语法。
6709+
6710+
- [`/ab+c/i`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp)
6711+
6712+
正则表达式字面量语法。
6713+
6714+
- [`( )`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Grouping)
6715+
6716+
分组操作符。
6717+
6718+
### 左表达式
6719+
6720+
6721+
6722+
左边的值是赋值的目标。
6723+
6724+
- [属性访问符](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Property_accessors)
6725+
6726+
成员运算符提供了对对象的属性或方法的访问 (`object.property``object["property"]`).
6727+
6728+
- [`new`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/new)
6729+
6730+
`new` 运算符创建了构造函数实例。
6731+
6732+
- [`new.target`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/new.target)
6733+
6734+
在构造器中,`new.target` 指向[`new`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/new)调用的构造器。
6735+
6736+
- [`super`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/super)
6737+
6738+
`super` 关键字调用父类的构造器.
6739+
6740+
- [`...obj`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Spread_operator)
6741+
6742+
展开运算符可以将一个可迭代的对象在函数调用的位置展开成为多个参数,或者在数组字面量中展开成多个数组元素。
6743+
6744+
### 自增和自减
6745+
6746+
6747+
6748+
前置/后置自增运算符和前置/后置自减运算符.
6749+
6750+
- [`A++`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment)
6751+
6752+
后置自增运算符.
6753+
6754+
- [`A--`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement)
6755+
6756+
后置自减运算符.
6757+
6758+
- [`++A`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment)
6759+
6760+
前置自增运算符.
6761+
6762+
- [`--A`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement)
6763+
6764+
前置自减运算符.
6765+
6766+
### 一元运算符
6767+
6768+
6769+
6770+
一元运算符只有一个操作数.
6771+
6772+
- [`delete`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/delete)
6773+
6774+
`delete` 运算符用来删除对象的属性.
6775+
6776+
- [`void`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/void)
6777+
6778+
`void` 运算符表示表达式放弃返回值.
6779+
6780+
- [`typeof`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/typeof)
6781+
6782+
`typeof` 运算符用来判断给定对象的类型.
6783+
6784+
- [`+`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_plus)
6785+
6786+
一元加运算符将操作转换为Number类型.
6787+
6788+
- [`-`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_negation)
6789+
6790+
一元减运算符将操作转换为Number类型并取反.
6791+
6792+
- [`~`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_NOT)
6793+
6794+
按位非运算符.
6795+
6796+
- [`!`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_NOT)
6797+
6798+
逻辑非运算符.
6799+
6800+
### 算术运算符
6801+
6802+
6803+
6804+
算术运算符以二个数值(字面量或变量)作为操作数,并返回单个数值。
6805+
6806+
- [`+`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Addition)
6807+
6808+
加法运算符.
6809+
6810+
- [`-`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Subtraction)
6811+
6812+
减法运算符.
6813+
6814+
- [`/`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Division)
6815+
6816+
除法运算符.
6817+
6818+
- [`*`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Multiplication)
6819+
6820+
乘法运算符.
6821+
6822+
- [`%`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder)
6823+
6824+
取模运算符.
6825+
6826+
### 关系运算符
6827+
6828+
6829+
6830+
比较运算符比较二个操作数并返回基于比较结果的`Boolean`值。
6831+
6832+
- [`in`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/in)
6833+
6834+
`in运算符用来判断对象是否拥有给定属性`.
6835+
6836+
- [`instanceof`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/instanceof)
6837+
6838+
`instanceof` 运算符判断一个对象是否是另一个对象的实例.
6839+
6840+
- [`<`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than_operator)
6841+
6842+
小于运算符
6843+
6844+
- [`>`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_operator)
6845+
6846+
大于运算符.
6847+
6848+
- [`<=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than_or_equal_operator)
6849+
6850+
小于等于运算符.
6851+
6852+
- [`>=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_or_equal_operator)
6853+
6854+
大于等于运算符。
6855+
6856+
**注意: =>** 不是运算符,而是[`箭头函数`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions)的表示符。
6857+
6858+
### 相等运算符
6859+
6860+
6861+
6862+
如果相等,操作符返回的是Boolean(布尔)类型的true,否则是false。
6863+
6864+
- [`==`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Equality)
6865+
6866+
相等 运算符.
6867+
6868+
- [`!=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Inequality)
6869+
6870+
不等 运算符.
6871+
6872+
- [`===`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Identity)
6873+
6874+
全等 运算符.
6875+
6876+
- [`!==`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Nonidentity)
6877+
6878+
非全等 运算符.
6879+
6880+
### 位移运算符
6881+
6882+
6883+
6884+
在二进制的基础上对数字进行移动操作
6885+
6886+
- [`<<`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Left_shift)
6887+
6888+
按位左移运算符。
6889+
6890+
- [`>>`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Right_shift)
6891+
6892+
按位右移运算符。
6893+
6894+
- [`>>>`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Unsigned_right_shift)
6895+
6896+
按位无符号右移运算符。
6897+
6898+
### 二进制位运算符
6899+
6900+
6901+
6902+
二进制运算符将它们的操作数作为32个二进制位(0或1)的集合,并返回标准的JavaScript数值。
6903+
6904+
- [`&`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_AND)
6905+
6906+
二进制位与(AND)。
6907+
6908+
- [`|`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_OR)
6909+
6910+
二进制位或(OR)。
6911+
6912+
- [`^`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_XOR)
6913+
6914+
二进制位异或(XOR)。
6915+
6916+
### 二元逻辑运算符
6917+
6918+
6919+
6920+
逻辑运算符典型的用法是用于boolean(逻辑)值运算, 它们返回boolean值。
6921+
6922+
- [`&&`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_AND)
6923+
6924+
逻辑与.
6925+
6926+
- [`||`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_OR)
6927+
6928+
逻辑或.
6929+
6930+
### 条件(三元)运算符
6931+
6932+
6933+
6934+
- [`(condition ? ifTrue : ifFalse)`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Conditional_Operator)
6935+
6936+
条件元素运算符把两个结果中其中一个符合运算逻辑的值返回。
6937+
6938+
### 赋值运算符
6939+
6940+
6941+
6942+
赋值元素符会将右边的操作数的值分配给左边的操作数,并将其值修改为右边操作数相等的值。
6943+
6944+
- [`=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Assignment)
6945+
6946+
赋值运算符。
6947+
6948+
- [`*=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Multiplication_assignment)
6949+
6950+
赋值乘积。
6951+
6952+
- [`/=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Division_assignment)
6953+
6954+
赋值商。
6955+
6956+
- [`%=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Remainder_assignment)
6957+
6958+
赋值求余。
6959+
6960+
- [`+=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Addition_assignment)
6961+
6962+
赋值求和。
6963+
6964+
- [`-=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Subtraction_assignment)
6965+
6966+
赋值求差。
6967+
6968+
- [`<<=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Left_shift_assignment)
6969+
6970+
左位移。
6971+
6972+
- [`>>=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Right_shift_assignment)
6973+
6974+
右位移。
6975+
6976+
- [`>>>=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Unsigned_right_shift_assignment)
6977+
6978+
无符号右位移。
6979+
6980+
- [`&=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Bitwise_AND_assignment)
6981+
6982+
赋值与。
6983+
6984+
- [`^=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Bitwise_XOR_assignment)
6985+
6986+
赋值按位异或。
6987+
6988+
- [`|=`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Bitwise_OR_assignment)
6989+
6990+
赋值或。
6991+
6992+
- [`[a, b\] = [1, 2]`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) [`{a, b} = {a:1, b:2}`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment)
6993+
6994+
解构赋值允许你分配数组或者对象变量的属性通过使用规定的语法,其看起来和数组和对象字面量很相似。
6995+
6996+
- 逗号操作符
6997+
6998+
- [`,`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Comma_Operator)
6999+
7000+
逗号操作符允许在一个判断状态中有多个表达式去进行运算并且最后返回最后一个表达式的值。

0 commit comments

Comments
 (0)