結果 : make a function synchronous javascript