結果 : how to write an api in javascript