From db39a8be86e8e9e9bf9b32f3590ef34ad486d8a2 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Mon, 24 Aug 2015 16:04:42 +0300 Subject: [PATCH] up --- .../12-ifelse/1-if-zero-string/task.md | 6 ++--- .../2-check-standard/ifelse_task2/index.html | 6 ++--- 1-js/2-first-steps/7-types-intro/article.md | 23 +++++++++++++++++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/1-js/2-first-steps/12-ifelse/1-if-zero-string/task.md b/1-js/2-first-steps/12-ifelse/1-if-zero-string/task.md index 27ce5aee..24321379 100644 --- a/1-js/2-first-steps/12-ifelse/1-if-zero-string/task.md +++ b/1-js/2-first-steps/12-ifelse/1-if-zero-string/task.md @@ -1,12 +1,12 @@ -# if (строка с нулём) +# if (a string with zero) [importance 5] -Выведется ли `alert`? +Will `alert` be shown? ```js if ("0") { - alert( 'Привет' ); + alert( 'Hello' ); } ``` diff --git a/1-js/2-first-steps/12-ifelse/2-check-standard/ifelse_task2/index.html b/1-js/2-first-steps/12-ifelse/2-check-standard/ifelse_task2/index.html index 392ead19..b6e3b589 100644 --- a/1-js/2-first-steps/12-ifelse/2-check-standard/ifelse_task2/index.html +++ b/1-js/2-first-steps/12-ifelse/2-check-standard/ifelse_task2/index.html @@ -3,12 +3,12 @@ diff --git a/1-js/2-first-steps/7-types-intro/article.md b/1-js/2-first-steps/7-types-intro/article.md index 570d3b8b..ec51c9a4 100644 --- a/1-js/2-first-steps/7-types-intro/article.md +++ b/1-js/2-first-steps/7-types-intro/article.md @@ -43,16 +43,35 @@ We'll cover working with numbers in the chapter [](/number). ```js var str = "Hello"; var str2 = 'Single quotes are ok too'; -var prase = `can embed ${str}`; +var phrase = `can embed ${str}`; ``` In JavaScript, there are 3 types of quotes.
    -
  1. Double quotes and single quotes are essentially the same.
  2. +
  3. Double quotes: `"Hello"`.
  4. +
  5. Single quotes: `'Hello'`.
  6. Backtricks are "extended functionality" quotes. They allow to embed other variables or even expressions into the string wrapping them by `${…}`.
+Double and single quotes are essentially the same. The only difference between them can be seen when the string includes the quotation character `"` or `'`. + +A double quote symbol may appear inside single-quoted lines and vise versa: + +```js +var hello = "I'm JavaScript"; // single-quote inside "…" +var name = 'My "official" name is "EcmaScript"'; // vise versa +``` + +If we want to include a single quote inside a same-quoted string, we can do it too. But we need to prepend it with a slash: + +```js +// prepend ' inside the string with a slash \' +var hello = 'I\'m JavaScript'; +``` + +Similarly with double quotes. + [smart header="There is no *character* type."] In some languages, there is a special "character" type for a single character. For example, in the C language it is `char`.