JSFiddle - React, Tailwind, and code Playground
by edubba
JavaScript
function sqrt(n, g) {
if (!g) {
g = n / 2.0;
}
console.log(g);
q = n / g;
ng = (g + q) / 2.0;
if (g == ng) {
return ng;
}
return sqrt(n, ng);
}
console.log(sqrt(8))