結果 : javascript wait for function to complete before continuing