Решение проблемы
См. документацию по MDN о выражениях, операторах и операторах.
Основные ключевые слова и общие выражения
thisключевое слово:
var x = function()vs. function x() — Синтаксис объявления функции
(function(){… })() — IIFE (выражение немедленно вызываемой функции)
(function(){…})();работает, но function(){…}();не работает?(function(){…})();против(function(){…}());!function(){…}();- Что делает восклицательный знак перед функцией?+function(){…}();- Знак плюса JavaScript перед выражением функции!vs точка с запятой в начале(function(window, undefined){…}(window));someFunction()() — Функции, которые возвращают другие функции
=> — Знак равенства, больше чем: синтаксис выражения стрелочной функции
|> — Труба, больше чем: оператор конвейера
function*, yield, yield* — Звездочка после functionили yield: генераторные функции
[], Array() — Квадратные скобки: запись массива
If the square brackets appear on the left side of an assignment ([a] =...), or inside a function's parameters, it's a destructuring assignment.
{key: value} — Curly brackets: object literal syntax (not to be confused with blocks)
If the curly brackets appear on the left side of an assignment ({ a } =...) or inside a function's parameters, it's a destructuring assignment.
`…${…}…` — Backticks, dollar sign with curly brackets: template literals
`…${…}…` code from the node docs mean?/…/ — Slashes: regular expression literals
$ — Dollar sign in regex replace patterns: $$, $&, $`, $', $n
() — Parentheses: grouping operator
Property-related expressions
obj.prop, obj[prop], obj["prop"] — Square brackets or dot: property accessors
?., ?.[], ?.() — Question mark, dot: optional chaining operator
:: — Double colon: bind operator
new operator
...iter — Three dots: spread syntax; rest parameters
(...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?Increment and decrement
++, -- — Double plus or minus: pre- / post-increment / -decrement operators
++someVariable vs someVariable++ in JavascriptUnary and binary (arithmetic, logical, bitwise) operators
delete operator
void operator
+, - — Plus and minus: addition or concatenation, and subtraction operators; unary sign operators
|, &, ^, ~ — Single pipe, ampersand, circumflex, tilde: bitwise OR, AND, XOR, & NOT operators
~1 equal -2?% — Percent sign: remainder operator
&&, ||, ! — Double ampersand, double pipe, exclamation point: logical operators
?? — Double question mark: nullish-coalescing operator
** — Double star: power operator (exponentiation)
x ** 2 is equivalent to Math.pow(x, 2)Equality operators
==, === — Equal signs: equality operators
!=, !== — Exclamation point and equal signs: inequality operators
Bit shift operators
<<, >>, >>> — Two or three angle brackets: bit shift operators
Conditional operator
…?…:… — Question mark and colon: conditional (ternary) operator
Assignment operators
= — Equal sign: assignment operator
This symbol is also used for default parameters or default values in a destructuring assignment:
%= — Percent equals: remainder assignment
+= — Plus equals: addition assignment operator
&&=, ||=, ??= — Double ampersand, pipe, or question mark, followed by equal sign: logical assignments
||= (or equals) in JavaScript?Destructuring
Comma operator
, — Comma operator (not to be confused with the comma used in variable declarations)
Control flow
{…} — Curly brackets: blocks (not to be confused with object literal syntax)
Declarations
var, let, const — Declaring variables
var a, b; — Comma used in variable declarations (not to be confused with the comma operator): JavaScript variable definition: Commas vs. SemicolonsLabel
label: — Colon: labels
Other
123n — n after integer: BigInt
# — Хэш (цифровой знак): частные методы или частные поля.
#символ в JavaScript?
Комментариев нет:
Отправить комментарий