JSFiddle - React, Tailwind, and code Playground
by Timatnet
JavaScript
var eps = 0.001;
function sqrt(x) {
var y = x/2;
for( ; Math.abs(y*y - x) > eps; ) {
y = (y + x/y)/2;
}
return y;
}
alert(sqrt(4));
alert(sqrt(16));
alert(sqrt(256));
alert(sqrt(256*256));