var a,b;
while (a!==b){
if (a>b) {
var a=a-b;
}
else {
var b=b-a;
}
}

so you enter numbers for a and b, and while the condition is true it is doing the given calculations and finally the a and b will became the same and the condition for WHILE will be false and after that it gives out a number a or b (doesnt matter cus both are equal already), also it works for some numbers but browser lags for some specific numbers for example if a=60 and b=120, i dont understand why by the way the given function calculates the largest common divisor of two given numbers, please help me and tell why is it lagging