translate

This commit is contained in:
Ilya Kantor 2016-03-06 00:59:16 +03:00
parent 811a6c7920
commit 98c987e794
84 changed files with 826 additions and 880 deletions

View file

@ -1,10 +1,12 @@
```js run demo
var a = +prompt("Введите первое число", "");
var b = +prompt("Введите второе число", "");
let a = +prompt("The first number?", "");
let b = +prompt("The second number?", "");
alert( a + b );
```
Обратите внимание на оператор `+` перед `prompt`, он сразу приводит вводимое значение к числу. Если бы его не было, то `a` и `b` были бы строками и складывались бы как строки, то есть `"1" + "2" = "12"`.
Note the unary plus `+` before `prompt`. It immediately converts the value to a number.
Otherwise, `a` and `b` would be string their sum would be their concatenation, that is: `"1" + "2" = "12"`.

View file

@ -2,10 +2,10 @@ importance: 5
---
# Интерфейс суммы
# Sum numbers from the visitor
Создайте страницу, которая предлагает ввести два числа и выводит их сумму.
Create a script that prompts the visitor to enter two numbers and then shows their sum.
[demo]
P.S. Есть "подводный камень" при работе с типами.
P.S. There is a gotcha with types.