--- id: cf1391c1c11feddfaeb4bdef title: Create Decimal Numbers with JavaScript challengeType: 1 videoUrl: 'https://scrimba.com/c/ca8GEuW' forumTopicId: 16826 localeTitle: 创建一个小数 --- ## Description
我们也可以把小数存储到变量中。小数也被称作浮点数提示
不是所有的实数都可以用 浮点数 来表示。因为可能存在四舍五入的错误,详情查看
## Instructions
创建一个变量myDecimal并给它赋值一个浮点数。(例如5.21)。
## Tests
```yml tests: - text: myDecimal应该是一个数字。 testString: assert(typeof myDecimal === "number"); - text: myDecimal应该包含小数点。 testString: assert(myDecimal % 1 != 0); ```
## Challenge Seed
```js var ourDecimal = 5.7; // Only change code below this line ```
### After Test
```js (function(){if(typeof myDecimal !== "undefined"){return myDecimal;}})(); ```
## Solution
```js var myDecimal = 9.9; ```