Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c1052d commit 054622cCopy full SHA for 054622c
1 file changed
Maths/SquareRoot.js
@@ -7,10 +7,8 @@
7
*/
8
9
function sqrt (num, precision = 10) {
10
- if (!Number.isFinite(num))
11
- throw new TypeError(`Expected a number, received ${typeof num}`)
12
- if (!Number.isFinite(precision))
13
- throw new TypeError(`Expected a number, received ${typeof precision}`)
+ if (!Number.isFinite(num)) { throw new TypeError(`Expected a number, received ${typeof num}`) }
+ if (!Number.isFinite(precision)) { throw new TypeError(`Expected a number, received ${typeof precision}`) }
14
let sqrt = 1
15
for (let i = 0; i < precision; i++) {
16
sqrt -= (sqrt * sqrt - num) / (2 * sqrt)
0 commit comments