結果 : javascript wait until function returns true