ok
This commit is contained in:
parent
f1b7de040a
commit
2b874a73be
59 changed files with 1227 additions and 1232 deletions
|
@ -1,6 +1,6 @@
|
|||
describe("extractCurrencyValue", function() {
|
||||
|
||||
it("выделяет из строки $120 число 120", function() {
|
||||
it("for the string $120 returns the number 120", function() {
|
||||
assert.strictEqual(extractCurrencyValue('$120'), 120);
|
||||
});
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Возьмём часть строки после первого символа и приведём к числу: `+str.slice(1)`.
|
||||
|
||||
|
|
|
@ -2,9 +2,15 @@ importance: 4
|
|||
|
||||
---
|
||||
|
||||
# Выделить число
|
||||
# Extract the money
|
||||
|
||||
Есть стоимость в виде строки: `"$120"`. То есть, первым идёт знак валюты, а затем -- число.
|
||||
We have a cost in the form `"$120"`. That is: the dollar sign goes first, and then the number.
|
||||
|
||||
Создайте функцию `extractCurrencyValue(str)`, которая будет из такой строки выделять число-значение, в данном случае 120.
|
||||
Create a function `extractCurrencyValue(str)` that would extract the numeric value from such string and return it.
|
||||
|
||||
The example:
|
||||
|
||||
```js
|
||||
alert( extractCurrencyValue('$120') === 120 ); // true
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue