結果 : javascript wait for one function to finish before continuing