JSFiddle - React, Tailwind, and code Playground

by kodisha

JavaScript

let sq = function(n) {
	
  let x = n;
  let y = 1;
  let e = 0.00000000001;
  console.log('-------------------');
  while ((x - y) > e) {
  	console.log(x, y);
    x = (x + y) /2;
    y = n / x;
    
  }
  
  return x;

}

sq(900)