結果 : javascript wait for recursive function to finish