2665. Counter II ¶ TypeScript 1 2 3 4 5 6 7 8 9 10 11 12 13 14type ReturnObj = { increment: () => number; decrement: () => number; reset: () => number; }; function createCounter(init: number): ReturnObj { let cur = init; return { increment: () => ++cur, decrement: () => --cur, reset: () => (cur = init), }; }