You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
## Cut Corners
|
|
|
|
|
|
|
|
### Instructions
|
|
|
|
|
|
|
|
Create some functions which behave like JavaScript's `Math` rounding functions:
|
|
|
|
|
|
|
|
- `round`: which behaves similar to `Math.round()`.
|
|
|
|
- `ceil`: which behaves similar to `Math.ceil()`.
|
|
|
|
- `floor`: which behaves similar to `Math.floor()`.
|
|
|
|
- `trunc`: which behaves similar to `Math.trunc()`.
|
|
|
|
|
|
|
|
> Some restrictions apply:
|
|
|
|
> - You may not use strings conversion to do it
|
|
|
|
> - No bitwise operator
|
|
|
|
> - No `%` operator
|
|
|
|
|
|
|
|
### Notions
|
|
|
|
|
|
|
|
- [Math](https://devdocs.io/javascript/global_objects/math)
|
|
|
|
|
|
|
|
### Code provided
|
|
|
|
|
|
|
|
> The provided code will be added to your solution, and does not need to be submitted.
|
|
|
|
|
|
|
|
```js
|
|
|
|
Math.round = Math.ceil = Math.floor = Math.trunc = undefined
|
|
|
|
```
|