結果 : how to make for loop synchronous in javascript