Skip to content

Commit 15019c1

Browse files
committed
up
1 parent 98a5df9 commit 15019c1

8 files changed

Lines changed: 164 additions & 162 deletions

File tree

1-js/2-first-steps/11-uibasic/1-simple-page/solution.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
JS-код:
1+
JavaScript-code:
22

33
```js
44
//+ demo run
5-
var name = prompt("Ваше имя?", "");
5+
var name = prompt("What is your name?", "");
66
alert( name );
77
```
88

9-
Полная страница:
9+
The full page:
1010

1111
```html
1212
<!DOCTYPE html>
1313
<html>
1414

15-
<head>
16-
<meta charset="utf-8">
17-
</head>
18-
1915
<body>
2016

2117
<script>
22-
var name = prompt("Ваше имя?", "");
18+
var name = prompt("What is your name?", "");
2319
alert( name );
2420
</script>
2521

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Простая страница
1+
# A simple page
22

33
[importance 4]
44

5-
Создайте страницу, которая спрашивает имя и выводит его.
5+
Create a web-page which asks for a name and outputs it.
66

77
[demo /]
88

1-js/2-first-steps/11-uibasic/article.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Run this code in Internet Explorer to see that:
6060
var test = prompt("Test");
6161
```
6262

63-
So, for IE looking good, it's recommended to always provide the second argument:
63+
So, to look good in IE, it's recommended to always provide the second argument:
6464

6565
```js
6666
//+ run
@@ -77,34 +77,33 @@ var test = prompt("Test", ''); // <-- for IE
7777
result = confirm(question);
7878
```
7979

80-
`confirm` выводит окно с вопросом `question` с двумя кнопками: OK и CANCEL.
80+
Function `confirm` shows a modal window with a `question` and two buttons: OK and CANCEL.
8181

82-
**Результатом будет `true` при нажатии OK и `false` - при CANCEL([key Esc]).**
82+
The result is `true` if OK is pressed and `false` otherwise.
8383

84-
Например:
84+
For example:
8585

8686
```js
8787
//+ run
88-
var isAdmin = confirm("Вы - администратор?");
88+
var isBoss = confirm("Are you the boss?");
8989

90-
alert( isAdmin );
90+
alert( isBoss ); // true is OK is pressed
9191
```
9292

93-
## Особенности встроенных функций
93+
## The limitations
9494

95-
Конкретное место, где выводится модальное окно с вопросом -- обычно это центр браузера, и внешний вид окна выбирает браузер. Разработчик не может на это влиять.
95+
There are two limitations shared by all the methods:
96+
<ol>
97+
<li>The exact location of the modal window is determined by the browser. Usually it's in the center.</li>
98+
<li>The exact look of the window also depends on the browser. We can't modify it.</li>
99+
</ol>
96100

97-
С одной стороны -- это недостаток, так как нельзя вывести окно в своем, особо красивом, дизайне.
101+
That is the price for simplicity. There are other means to show windows and interact with the visitor, but if the "bells and whistles" do not matter much, these methods are just fine.
98102

99-
С другой стороны, преимущество этих функций по сравнению с другими, более сложными методами взаимодействия, которые мы изучим в дальнейшем -- как раз в том, что они очень просты.
100-
101-
Это самый простой способ вывести сообщение или получить информацию от посетителя. Поэтому их используют в тех случаях, когда простота важна, а всякие "красивости" особой роли не играют.
102-
103-
104-
## Резюме
103+
## Summary
105104

106105
<ul>
107-
<li>`alert` выводит сообщение.</li>
108-
<li>`prompt` выводит сообщение и ждёт, пока пользователь введёт текст, а затем возвращает введённое значение или `null`, если ввод отменён (CANCEL/[key Esc]).</li>
109-
<li>`confirm` выводит сообщение и ждёт, пока пользователь нажмёт "OK" или "CANCEL" и возвращает `true/false`.</li>
106+
<li>`alert` shows a message.</li>
107+
<li>`prompt` shows a message asking the user to input text. It returns the text or, if CANCEL or [key Esc] is clicked, all browsers except Safari return `null`.</li>
108+
<li>`confirm` shows a message and waits the user to press "OK" or "CANCEL". It returns `true` for OK and `false` for CANCEL/[key Esc].</li>
110109
</ul>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
**Да, выведется,** т.к. внутри `if` стоит строка `"0"`.
1+
**Yes, it will.**
22

3-
Любая строка, кроме пустой (а здесь она не пустая), в логическом контексте является `true`.
3+
Any string except an empty one (and `"0"` is not empty) becomes `true` in the logical context.
44

5-
Можно запустить и проверить:
5+
We can run and check:
66

77
```js
88
//+ run
99
if ("0") {
10-
alert( 'Привет' );
10+
alert( 'Hello' );
1111
}
1212
```
1313

1-js/2-first-steps/12-ifelse/2-check-standard/task.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# Проверка стандарта
1+
# The name of JavaScript
22

33
[importance 2]
44

5-
Используя конструкцию `if..else`, напишите код, который будет спрашивать: "Каково "официальное" название JavaScript?".
5+
Using the `if..else` construct, write the code which asks: 'What is the "official" name of JavaScript?'
66

7-
Если посетитель вводит "EcmaScript", то выводить "Верно!", если что-то другое -- выводить "Не знаете? "EcmaScript"!".
8-
9-
Блок-схема:
7+
If the visitor enters "EcmaScript", then output "Right!", otherwise -- output: "Didn't know? EcmaScript!"
108

119
<img src="ifelse_task2.png">
1210

0 commit comments

Comments
 (0)