pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/javascript-tutorial/uk.javascript.info/pull/25.patch

ΌΠΎΠΆΠ½Π°* опускати ΠΊΡ€Π°ΠΏΠΊΡƒ Π· комою. АлС Π±Π΅Π·ΠΏΠ΅Ρ‡Π½Ρ–ΡˆΠ΅ -- особливо для Π½ΠΎΠ²ΠΈΡ‡ΠΊΠ° -- використовувати Ρ—Ρ…. -## Comments +## ΠšΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ– -As time goes on, programs become more and more complex. It becomes necessary to add *comments* which describe what the code does and why. +Π— часом ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΈ ΡΡ‚Π°ΡŽΡ‚ΡŒ всС ΡΠΊΠ»Π°Π΄Π½Ρ–ΡˆΠΈΠΌΠΈ Ρ– ΡΠΊΠ»Π°Π΄Π½Ρ–ΡˆΠΈΠΌΠΈ. Π’ΠΈΠ½ΠΈΠΊΠ°Ρ” ΠΏΠΎΡ‚Ρ€Π΅Π±Π° Π΄ΠΎΠ΄Π°Π²Π°Ρ‚ΠΈ *ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ–*, які Π±ΡƒΠ΄ΡƒΡ‚ΡŒ описувати Ρ‰ΠΎ Ρ€ΠΎΠ±ΠΈΡ‚ΡŒ ΠΊΠΎΠ΄ Ρ– Ρ‡ΠΎΠΌΡƒ. -Comments can be put into any place of a script. They don't affect its execution because the engine simply ignores them. +ΠšΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ– ΠΌΠΎΠΆΠ½Π° писати Π² Π±ΡƒΠ΄ΡŒ-якому місці скрипта. Π’ΠΎΠ½ΠΈ Π½Π΅ Π²ΠΏΠ»ΠΈΠ²Π°ΡŽΡ‚ΡŒ Π½Π° ΠΉΠΎΠ³ΠΎ виконання, Ρ‚ΠΎΠΌΡƒ Ρ‰ΠΎ Ρ€ΡƒΡˆΡ–ΠΉ просто Ρ–Π³Π½ΠΎΡ€ΡƒΡ” ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ–. -**One-line comments start with two forward slash characters `//`.** +**ΠžΠ΄Π½ΠΎΡ€ΡΠ΄ΠΊΠΎΠ²Ρ– ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ– ΠΏΠΎΡ‡ΠΈΠ½Π°ΡŽΡ‚ΡŒΡΡ Π· ΠΏΠΎΠ΄Π²Ρ–ΠΉΠ½ΠΎΡ— косої риски `//`.** -The rest of the line is a comment. It may occupy a full line of its own or follow a statement. +Частина рядка після `//` Π²Π²Π°ΠΆΠ°Ρ”Ρ‚ΡŒΡΡ ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Π΅ΠΌ. Π’Π°ΠΊΠΈΠΉ ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€ ΠΌΠΎΠΆΠ΅ Π·Π°ΠΉΠΌΠ°Ρ‚ΠΈ вСсь рядок, Π°Π±ΠΎ знаходитися після інструкції. -Like here: +Ось Ρ‚Π°ΠΊ: ```js run -// This comment occupies a line of its own -alert('Hello'); +// Π¦Π΅ΠΉ ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€ Π·Π°ΠΉΠΌΠ°Ρ” вСсь рядок +alert('ΠŸΡ€ΠΈΠ²Ρ–Ρ‚'); -alert('World'); // This comment follows the statement +alert('Π‘Π²Ρ–Ρ‚'); // Π¦Π΅ΠΉ ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€ Π·Π½Π°Ρ…ΠΎΠ΄ΠΈΡ‚ΡŒΡΡ після інструкції ``` -**Multiline comments start with a forward slash and an asterisk /* and end with an asterisk and a forward slash */.** +**Багаторядкові ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ– ΠΏΠΎΡ‡ΠΈΠ½Π°ΡŽΡ‚ΡŒΡΡ Π· косої риски Π· Π·Ρ–Ρ€ΠΎΡ‡ΠΊΠΎΡŽ /* Ρ– Π·Π°ΠΊΡ–Π½Ρ‡ΡƒΡ”Ρ‚ΡŒΡΡ Π·Ρ–Ρ€ΠΎΡ‡ΠΊΠΎΡŽ Π· косою Ρ€ΠΈΡΠΊΠΎΡŽ */.** -Like this: +Ось Ρ‚Π°ΠΊ: ```js run -/* An example with two messages. -This is a multiline comment. +/* ΠŸΡ€ΠΈΠΊΠ»Π°Π΄ Π· Π΄Π²ΠΎΠΌΠ° повідомлСннями. +Π¦Π΅ багаторядковий ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€. */ -alert('Hello'); -alert('World'); +alert('ΠŸΡ€ΠΈΠ²Ρ–Ρ‚'); +alert('Π‘Π²Ρ–Ρ‚'); ``` -The content of comments is ignored, so if we put code inside /* ... */, it won't execute. +Вміст комСнтаря Ρ–Π³Π½ΠΎΡ€ΡƒΡ”Ρ‚ΡŒΡΡ, Ρ‚ΠΎΠΌΡƒ, якщо ΠΌΠΈ напишСмо всСрСдині /* ... */ ΠΊΠΎΠ΄, Π²Ρ–Π½ Π½Π΅ Π²ΠΈΠΊΠΎΠ½Π°Ρ”Ρ‚ΡŒΡΡ. -Sometimes it can be handy to temporarily disable a part of code: +Π”Π΅ΠΊΠΎΠ»ΠΈ Π²ΠΈΠ½ΠΈΠΊΠ°Ρ” Π½Π΅ΠΎΠ±Ρ…Ρ–Π΄Π½Ρ–ΡΡ‚ΡŒ тимчасово Π²ΠΈΠΌΠΊΠ½ΡƒΡ‚ΠΈ частину ΠΊΠΎΠ΄Ρƒ: ```js run -/* Commenting out the code -alert('Hello'); +/* Π—Π°ΠΊΠΎΠΌΠ΅Π½Ρ‚ΠΎΠ²Π°Π½ΠΈΠΉ ΠΊΠΎΠ΄ +alert('ΠŸΡ€ΠΈΠ²Ρ–Ρ‚'); */ -alert('World'); +alert('Π‘Π²Ρ–Ρ‚'); ``` -```smart header="Use hotkeys!" -In most editors, a line of code can be commented out by pressing the `key:Ctrl+/` hotkey for a single-line comment and something like `key:Ctrl+Shift+/` -- for multiline comments (select a piece of code and press the hotkey). For Mac, try `key:Cmd` instead of `key:Ctrl`. +```smart header="ВикористовуйтС ΠΊΠΎΠΌΠ±Ρ–Π½Π°Ρ†Ρ–Ρ— ΠΊΠ»Π°Π²Ρ–Ρˆ!" +Π’ Π±Ρ–Π»ΡŒΡˆΠΎΡΡ‚Ρ– Ρ€Π΅Π΄Π°ΠΊΡ‚ΠΎΡ€Ρ–Π², рядок ΠΊΠΎΠ΄Ρƒ ΠΌΠΎΠΆΠ½Π° Π·Π°ΠΊΠΎΠΌΠ΅Π½Ρ‚ΡƒΠ²Π°Ρ‚ΠΈ, Π½Π°Ρ‚ΠΈΡΠ½ΡƒΠ²ΡˆΠΈ ΠΊΠΎΠΌΠ±Ρ–Π½Π°Ρ†Ρ–ΡŽ ΠΊΠ»Π°Π²Ρ–Ρˆ `key:Ctrl+/`, Π° Ρ‰ΠΎΠ± Π·Π°ΠΊΠΎΠΌΠ΅Π½Ρ‚ΡƒΠ²Π°Ρ‚ΠΈ Π΄Π΅ΠΊΡ–Π»ΡŒΠΊΠ° рядків – Π²ΠΈΠ΄Ρ–Π»Ρ–Ρ‚ΡŒ ΠΏΠΎΡ‚Ρ€Ρ–Π±Π½Ρ– рядки Ρ– Π½Π°Ρ‚ΠΈΡΠ½Ρ–Ρ‚ΡŒ ΠΊΠΎΠΌΠ±Ρ–Π½Π°Ρ†Ρ–ΡŽ ΠΊΠ»Π°Π²Ρ–Ρˆ `key:Ctrl+Shift+/`. Для Mac, ΠΏΠΎΡ‚Ρ€Ρ–Π±Π½ΠΎ натискати ΠΊΠ»Π°Π²Ρ–ΡˆΡƒ `key:Cmd` Π·Π°ΠΌΡ–ΡΡ‚ΡŒ `key:Ctrl`. ``` -````warn header="Nested comments are not supported!" -There may not be `/*...*/` inside another `/*...*/`. +````warn header="Π’ΠΊΠ»Π°Π΄Π΅Π½Ρ– ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ– Π½Π΅ ΠΏΡ–Π΄Ρ‚Ρ€ΠΈΠΌΡƒΡŽΡ‚ΡŒΡΡ!" +НС ΠΌΠΎΠΆΠ΅ Π±ΡƒΡ‚ΠΈ `/*...*/` всСрСдині `/*...*/`. -Such code will die with an error: +Π’Π°ΠΊΠΈΠΉ ΠΊΠΎΠ΄ "Π²ΠΌΡ€Π΅" Π· помилкою: ```js run no-beautify /* - /* nested comment ?!? */ + /* Π²ΠΊΠ»Π°Π΄Π΅Π½ΠΈΠΉ ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€ ?!? */ */ -alert( 'World' ); +alert( 'Π‘Π²Ρ–Ρ‚' ); ``` ```` -Please, don't hesitate to comment your code. +Π‘ΡƒΠ΄ΡŒ ласка, Π½Π΅ соромтСся ΠΊΠΎΠΌΠ΅Π½Ρ‚ΡƒΠ²Π°Ρ‚ΠΈ ваш ΠΊΠΎΠ΄. -Comments increase the overall code footprint, but that's not a problem at all. There are many tools which minify code before publishing to a production server. They remove comments, so they don't appear in the working scripts. Therefore, comments do not have negative effects on production at all. +ΠšΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ– Π·Π±Ρ–Π»ΡŒΡˆΡƒΡŽΡ‚ΡŒ Ρ€ΠΎΠ·ΠΌΡ–Ρ€ ΠΊΠΎΠ΄Ρƒ, Π°Π»Π΅ Ρ†Π΅ Π½Π΅ ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΠ°. Π„ Π±Π°Π³Π°Ρ‚ΠΎ інструмСнтів, які ΠΌΡ–Π½Ρ–Ρ„Ρ–ΠΊΡƒΡŽΡ‚ΡŒ ΠΊΠΎΠ΄ ΠΏΠ΅Ρ€Π΅Π΄ ΠΏΡƒΠ±Π»Ρ–ΠΊΠ°Ρ†Ρ–Ρ”ΡŽ Π½Π° Ρ€ΠΎΠ±ΠΎΡ‡ΠΈΠΉ сСрвСр. Π’ΠΎΠ½ΠΈ Π²ΠΈΠ΄Π°Π»ΡΡ‚ΡŒ ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ–, Ρ‚ΠΎΠΌΡƒ Ρ—Ρ… Π½Π΅ Π±ΡƒΠ΄Π΅ Π² Ρ€ΠΎΠ±ΠΎΡ‡ΠΈΡ… скриптах. Π’Π°ΠΊΠΈΠΌ Ρ‡ΠΈΠ½ΠΎΠΌ, ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ– ΠΆΠΎΠ΄Π½ΠΈΠΌ Ρ‡ΠΈΠ½ΠΎΠΌ Π½Π΅ Π²ΠΏΠ»ΠΈΠ²Π°ΡŽΡ‚ΡŒ Π½Π° Ρ€ΠΎΠ±ΠΎΡ‡ΠΈΠΉ ΠΊΠΎΠ΄. -Later in the tutorial there will be a chapter that also explains how to write better comments. +ΠŸΡ–Π·Π½Ρ–ΡˆΠ΅, Π² посібнику Π±ΡƒΠ΄Π΅ Ρ€ΠΎΠ·Π΄Ρ–Π» , який ΠΏΠΎΡΡΠ½ΠΈΡ‚ΡŒ, як ΠΊΡ€Π°Ρ‰Π΅ писати ΠΊΠΎΠΌΠ΅Π½Ρ‚Π°Ρ€Ρ–. pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy