en.javascript.info/1-js/4-data-structures/3-string/4-extract-currency/task.md
Ilya Kantor 2b874a73be ok
2016-03-09 00:16:22 +03:00

334 B

importance: 4


Extract the money

We have a cost in the form "$120". That is: the dollar sign goes first, and then the number.

Create a function extractCurrencyValue(str) that would extract the numeric value from such string and return it.

The example:

alert( extractCurrencyValue('$120') === 120 ); // true