Files
freeCodeCamp/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
2022-05-26 12:41:58 +05:30

56 lines
1.2 KiB
Markdown

---
id: cf1391c1c11feddfaeb4bdef
title: Create Decimal Numbers with JavaScript
challengeType: 1
videoUrl: 'https://scrimba.com/c/ca8GEuW'
forumTopicId: 16826
dashedName: create-decimal-numbers-with-javascript
---
# --description--
We can store decimal numbers in variables too. Decimal numbers are sometimes referred to as <dfn>floating point</dfn> numbers or <dfn>floats</dfn>.
**Note:** computers represent numbers with finite precision. That's why floating-point operations cannot precisely represent true arithmetic operations, and this leads to many surprising situations. if you are facing one of these issues, open topic in the [freeCodeCamp forum](https://forum.freecodecamp.org/).
# --instructions--
Create a variable `myDecimal` and give it a decimal value with a fractional part (e.g. `5.7`).
# --hints--
`myDecimal` should be a number.
```js
assert(typeof myDecimal === 'number');
```
`myDecimal` should have a decimal point
```js
assert(myDecimal % 1 != 0);
```
# --seed--
## --after-user-code--
```js
(function(){if(typeof myDecimal !== "undefined"){return myDecimal;}})();
```
## --seed-contents--
```js
const ourDecimal = 5.7;
// Only change code below this line
```
# --solutions--
```js
const myDecimal = 9.9;
```