blob: be243d37b4ebf3c2fd3666de203c144779ff4f63 (
plain) (
tree)
|
|
# Square Root
Given a natural radicand, return its square root.
Note that the term "radicand" refers to the number for which the root is to be determined. That is, it is the number under the root symbol.
Check out the Wikipedia pages on [square root](https://en.wikipedia.org/wiki/Square_root) and [methods of computing square roots](https://en.wikipedia.org/wiki/Methods_of_computing_square_roots).
Recall also that natural numbers are positive real whole numbers (i.e. 1, 2, 3 and up).
The idea is not to use the built-in javascript functions such as `Math.sqrt(x)`, `x ** 0.5` or `x ** (1/2)`, it's to build your own.
## Setup
Go through the setup instructions for Javascript to install the necessary
dependencies:
[https://exercism.io/tracks/javascript/installation](https://exercism.io/tracks/javascript/installation)
## Requirements
Please `cd` into exercise directory before running all below commands.
Install assignment dependencies:
```bash
$ npm install
```
## Making the test suite pass
Execute the tests with:
```bash
$ npm test
```
In the test suites all tests but the first have been skipped.
Once you get a test passing, you can enable the next one by changing `xtest` to
`test`.
## Submitting Solutions
Once you have a solution ready, you can submit it using:
```bash
exercism submit square-root.js
```
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have
completed the exercise.
## Exercise Source Credits
wolf99 [https://github.com/exercism/problem-specifications/pull/1582](https://github.com/exercism/problem-specifications/pull/1582)
|