結果 : javascript wait for previous function to finish