22 lines
933 B
Markdown
22 lines
933 B
Markdown
---
|
||
title: Comment Your JavaScript Code
|
||
localeTitle: Комментарий
|
||
---
|
||
Комментарии - отличный способ оставить заметки для себя и для других людей, которым позже нужно будет выяснить, что он делает. Любой код в нем будет проигнорирован.
|
||
|
||
Давайте рассмотрим два способа написания комментариев в JavaScript.
|
||
|
||
* Комментарий с двойной косой чертой прокомментирует оставшуюся часть текста в текущей строке:
|
||
|
||
`// This is a single line comment.`
|
||
|
||
* Комментарий slash-star-star-slash будет комментировать все между символами `/*` и `*/` :
|
||
|
||
```javascript
|
||
/*
|
||
This is
|
||
a multi-line comment
|
||
(comment block)
|
||
*/
|
||
|
||
``` |