added javascript implemetation in comment