2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: bd7993c9c69feddfaeb7bdef
|
|
|
|
|
title: Multiply Two Decimals with JavaScript
|
|
|
|
|
challengeType: 1
|
|
|
|
|
videoUrl: ''
|
|
|
|
|
localeTitle: 使用JavaScript乘以两个小数
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
<section id="description">在JavaScript中,您也可以使用十进制数执行计算,就像整数一样。让我们将两位小数相乘得到它们的乘积。 </section>
|
|
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
<section id="instructions">更改<code>0.0</code>使产品等于<code>5.0</code> 。 </section>
|
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
|
|
|
|
- text: 变量<code>product</code>应该等于<code>5.0</code> 。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(product === 5.0);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: 你应该使用<code>*</code>运算符
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(/\*/.test(code));
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
var product = 2.0 * 0.0;
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### After Test
|
|
|
|
|
<div id='js-teardown'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
console.info('after the test');
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
|
|
|
|
</section>
|