結果 : how to define a function inside an object in javascript