結果 : javascript wait until for loop is finished