javascripting
Version:
Learn JavaScript by adventuring around in the terminal.
34 lines (18 loc) • 820 B
Markdown
# ROUNDING NUMBERS
We can do basic math using familiar operators like `+`, `-`, `*`, `/`, and `%`.
For more complex math, we can use the `Math` object.
In this challenge we'll use the `Math` object to round numbers.
## The challenge:
Create a file named `rounding-numbers.js`.
In that file define a variable named `roundUp` that references the float `1.5`.
We will use the `Math.round()` method to round the number up.
An example of using `Math.round()`:
```js
Math.round(0.5);
```
Define a second variable named `rounded` that references the output of the `Math.round()` method, passing in the `roundUp` variable as the argument.
Use `console.log()` to print that number to the terminal.
Check to see if your program is correct by running this command:
`javascripting verify rounding-numbers.js`