Fish Wang says to YSITD
var a = 36, b = 24; while(a % b != 0) { [a, b] = [b, a % b]; } console.log(b)