---
title: "Discussion on \"[leetcode/JS] 2620. Counter 풀이\" | Hashnode"
description: "Discussion on \"[leetcode/JS] 2620. Counter 풀이\". 문제\nhttps://leetcode.com/problems/counter/description/\n\n일급객체로서의 함수\n\n클로저\n\n\n풀이\n전체 코드\nfunction createCounter(n: number): () => number {\n    let current = n;\n    const counter = (): number => {\n        return current++;\n    };\n    // 일급객체 counter 함수 리턴\n  ..."
url: "https://hashnode.com/posts/leetcodejs-2620-counter/6959d107a1926bd2b4ec0123"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [\[leetcode/JS\] 2620. Counter 풀이](https://studio-pendant.hashnode.dev/leetcodejs-2620-counter?utm_source=hashnode&utm_medium=feed)

문제 https://leetcode.com/problems/counter/description/ 일급객체로서의 함수 클로저 풀이 전체 코드 function createCounter(n: number): () => number { let current = n; const counter = (): number => { return current++; }; // 일급객체 counter 함수 리턴 ...

Jan 4 · 1 min read · studio-pendant.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Donghan Kim](https://hashnode.com/@pendantK)

@pendantK · Suwon-si, Korea

  
[View profile](https://hashnode.com/@pendantK)

Web / iOS / Flutter Developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
