Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Small and medium teams
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
codebasic
learn-nodejs
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
learn-nodejs
/
ECMAScript
/
object
/
challege_poker_table.js
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
23 lines (17 loc) · 903 Bytes
master
Breadcrumbs
learn-nodejs
/
ECMAScript
/
object
/
challege_poker_table.js
Copy path
Top
File metadata and controls
Code
Blame
23 lines (17 loc) · 903 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* 도전과제: 포커 게임
세 명이 같은 포커 테이블에 앉아서 포커 게임을 하려고 한다.
a. 게임에서 사용되는 카드는 악의적인 이유로 중간에 순서가 바뀌거나 하면
안 된다. 생성된 포커 카드 정보가 외부에서 접근이 불가능하도록 호출할 때마다
카드덱에서 다음번 카드 1장을 반환하는 함수 makeCardDispender를
클로저 패턴을 활용해 작성하시오.
b. 각 참가자에게 두 개의 카드를 나눠주고, 각 참가자 객체의 hand 속성에
추가한다.
*/
var
poker
=
require
(
'./poker'
)
;
function
makeCardDispender
(
)
{
var
deck
=
poker
.
generateCardDeck
(
)
;
//포커 카드
deck
.
pop
(
)
;
// 마지막 원소를 추출하고, 배열에서 제거
}
var
cardDispender1
=
makeCardDispender
(
)
;
var
cardDispender2
=
makeCardDispender
(
)
;
var
pokerCard
=
cardDispenser
(
)
;
// 다음 카드 1장.
You can’t perform that action at this time.