Open
Conversation
This reverts commit 235112a.
ff1451
reviewed
Apr 9, 2025
| }); | ||
|
|
||
|
|
||
| document.getElementById('count-input').addEventListener('input', () => { |
There was a problem hiding this comment.
const input = document.getElementById('count-input');
이미 상단에서 DOM 요소를 가져왔으니 또 가져올 필요는 없어 보여요
There was a problem hiding this comment.
document.getElementById('count-input').addEventListener('input', (e) => {
const count = parseInt(e.target.value) || 0;
totalPrice.textContent = `총 금액: ${count * 1000}원 (1장당 1,000원)`;
});
처럼 event 객체를 이용해서 사용할 수도 있어요 자주 사용되는 방식이니 공부해두시면 좋을 것 같아요
Comment on lines
+72
to
+81
| const winning = displayWinningNumbers(); | ||
|
|
||
| for (let i = 0; i < count; i++) { | ||
| const numbers = RandomNumber(); | ||
| const matchCount = checkMatches(numbers, winning); | ||
| const row = createLotto(numbers); | ||
|
|
||
| const resultText = document.createElement('p'); | ||
| resultText.className = 'result-badge'; | ||
| resultText.textContent = `결과: ${matchCount}개 일치` + (matchCount === 6 ? ' - 당첨!' : ''); |
There was a problem hiding this comment.
지금 구조에서는 구매하기 버튼이 이번주 당첨번호 생성, 내가 구매한 번호 생성을 모두 수행하는 것으로 보여요
기능 명세상으로는 번호 생성하기 버튼을 클릭시 이번주 당첨번호가 생성되고 당첨 여부를 검증하니 수정해보면 좋을 것 같아요
Comment on lines
+5
to
+8
| height: 100vh; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; |
There was a problem hiding this comment.
화면 배율에 따라 로또를 많이 구매했을때 잘리는 현상이 발생할 수 있을 것 같아요
Comment on lines
+64
to
+76
| .ball-yellow { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| width: 45px; | ||
| height: 45px; | ||
| border-radius: 50%; | ||
| font-weight: bold; | ||
| margin: 5px; | ||
| font-size: 18px; | ||
| color: white; | ||
| background-color: #fbc400; | ||
| } |
There was a problem hiding this comment.
공의 색상을 지정하는 부분과 그외의 공통적인 부분을 분리해서 적용한다면 중복되는 코드를 줄일 수 있어요
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); | ||
| text-align: center; | ||
| box-sizing: border-box; | ||
| margin-top: 0; |
| const MyNumber = document.createElement('p'); | ||
| MyNumber.textContent = "내가 구매한 번호:"; | ||
| winningArea.appendChild(MyNumber); | ||
| winningArea.style.display = 'block'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.