結果 : javascript wait function finish before continuing