結果 : javascript wait for while loop to finish