We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2c1052d commit 054622cCopy full SHA for 054622c
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