JavaScript Implemention of SadaKhata