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.
|
|
|
## Sign
|
|
|
|
|
|
|
|
### Instructions
|
|
|
|
|
|
|
|
Create the `sign` function that takes one number argument
|
|
|
|
and return 1 if the number is positive, -1 if the number is negative
|
|
|
|
and 0 if the number is exactly 0
|
|
|
|
You must not just use `Math.sign`, make your own.
|
|
|
|
|
|
|
|
Create the `sameSign` function that takes 2 numbers as arguments and check
|
|
|
|
if they both have the same sign
|
|
|
|
|
|
|
|
|
|
|
|
### 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/if-else.js](https://nan-academy.github.io/js-training/examples/if-else.js)
|
|
|
|
- [devdocs.io/javascript/global_objects/math/sign](https://devdocs.io/javascript/global_objects/math/sign)
|
|
|
|
|
|
|
|
|
|
|
|
### Code provided
|
|
|
|
|
|
|
|
> all code provided will be added to your solution and doesn't need to be submited.
|
|
|
|
|
|
|
|
```js
|
|
|
|
Math.sign = undefined
|
|
|
|
```
|