Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(types): add typeof(x) syntax explanation box #2069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yalexaner wants to merge 1 commit into javascript-tutorial:master
base: master
Choose a base branch
Loading
from yalexaner:fix/ru-types-missing-box
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions 1-js/02-first-steps/05-types/article.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,16 @@ typeof alert // "function" (3)
*/!*
```

```smart header="Синтаксис `typeof(x)`"
Вы также можете встретить другой синтаксис: `typeof(x)`. Это то же самое, что и `typeof x`.

Чтобы было понятнее: `typeof` — это оператор, а не функция. Скобки здесь не являются частью `typeof`. Это скобки для математического группирования.

Обычно такие скобки содержат математическое выражение, например `(2 + 2)`, но здесь они содержат только один аргумент `(x)`. Синтаксически, они позволяют избежать пробела между оператором `typeof` и его аргументом, и некоторым людям это нравится.

Некоторые предпочитают `typeof(x)`, хотя синтаксис `typeof x` гораздо более распространён.
```

Последние три строки нуждаются в пояснении:

1. `Math` — это встроенный объект, который предоставляет математические операции и константы. Мы рассмотрим его подробнее в главе <info:number>. Здесь он служит лишь примером объекта.
Expand Down

AltStyle によって変換されたページ (->オリジナル) /