mirror of https://github.com/01-edu/public.git
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.
28 lines
813 B
28 lines
813 B
4 years ago
|
## Abs
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
Create a `isPositive` function that takes a number as
|
||
|
parameter and return true if the given number is
|
||
|
stricly positive, or false otherwise
|
||
|
|
||
|
Create the `abs` function that takes one number argument
|
||
|
and returns its absolute value.
|
||
|
You are not allowed to use `Math.abs`, make your own.
|
||
|
|
||
|
|
||
|
### Notions
|
||
|
|
||
|
- [nan-academy.github.io/js-training/examples/functions.js](https://nan-academy.github.io/js-training/examples/functions.js)
|
||
|
- [nan-academy.github.io/js-training/examples/ternary.js](https://nan-academy.github.io/js-training/examples/ternary.js)
|
||
|
- [devdocs.io/javascript/global_objects/math/abs](https://devdocs.io/javascript/global_objects/math/abs)
|
||
|
|
||
|
|
||
|
### Code provided
|
||
|
|
||
|
> all code provided will be added to your solution and doesn't need to be submited.
|
||
|
|
||
|
```js
|
||
|
Math.abs = undefined
|
||
|
```
|