結果 : how to make function synchronous in javascript