Conversation
Yejin0070
left a comment
There was a problem hiding this comment.
수고하셨습니다!👍🏻
아직 과제를 끝내지 않으셨다고 하셔서 현재 코드에 대해서 궁금한 질문 몇 개를 남겨놓았습니다!
| @@ -0,0 +1,69 @@ | |||
| <!DOCTYPE html> | |||
| <html lang="en"> | |||
| <span class="num1">?</span> | ||
| <span class="num2">?</span> | ||
| <span class="num3">?</span> | ||
| <span class="num4">?</span> | ||
| <span class="num5">?</span> | ||
| <span class="num6">?</span> |
There was a problem hiding this comment.
class와 id의 차이는 무엇일까요? 이 경우에는 id와 class중 어떤 것이 더 적합한 것 같나요?🧐
| @@ -0,0 +1,292 @@ | |||
| * { | |||
| font-family: Noto Sans KR; | |||
| width: 100%; | ||
| height: 100px; |
There was a problem hiding this comment.
px과 %의 차이는 무엇일까요? 또한 %는 어떤 것을 기준으로 계산이 될까요?
| const blank = document.getElementById("blank"); | ||
| const buyLottoButton = document.querySelector(".buyLottoButton"); |
There was a problem hiding this comment.
getElementById와 querySelector의 차이는 무엇일까요?
| const main = document.querySelector(".mainbox"); | ||
| main.addEventListener("DOMContentLoaded", ()=>{ |
There was a problem hiding this comment.
main이라는 요소가 있기도 하고, 어떤 main인지 가르키는 바가 명확하지 않아 변수명으로 적절하지 않은 것 같아요. 변수명을 바꿔볼까요?
| } | ||
|
|
||
| function matchNumber(arr1, arr2){ | ||
| return arr1.filter(num => arr2.includes(num).length); |
There was a problem hiding this comment.
이 코드가 잘 동작 하나요? arr2.includes(num)은 boolean 값을 반환하는데, 그 뒤에 .length를 붙이면 에러가 발생하지 않을까요?
| return lotto.sort((a, b) => a - b); | ||
| } | ||
|
|
||
| function generateNumbers(lottoCount) { //생성한 로또를 input만큼 배열에 담기기 |
There was a problem hiding this comment.
이 함수는 어디서 쓰이고 있나요? 다음 커밋에서 사용하고 있다면 상관없지만, 그렇지 않다면 다시 확인을 해볼까요?
|
|
||
| if(wantLottoCount >= 1){ //버튼클릭시 번호 생성버튼 색깔 바뀌는거+총 금액 바뀌는거 | ||
| createNumberButton.style.backgroundColor = '#4B89DC'; | ||
| money.textContent = wantLottoCount + ",000"; |
There was a problem hiding this comment.
| money.textContent = wantLottoCount + ",000"; | |
| money.textContent = (wantLottoCount * 1000).toLocaleString("ko-KR"); |
위 코드처럼 작성해보는 것은 어떨까요?🧐
지금 wantLottoCount가 문자열이 아닌 숫자인 것 같은데, 숫자 + 문자열로 작성하지 않고 이렇게 작성하면 더 직관적이고 좋을 것 같아요!
현재 처음에 결과창이 숨겨져 있다가 나오는 것과 번호 생성하기를 눌렀을 때 나의 번호와 비교하여 결과값을 나타내주는 부분과 잡다한 css를 완성하지 못했습니다. 수업 이전까지 작업한 내용을 제출하고자 pr하였습니다. 추후에 내용을 덧붙여 수정하도록 하겠습니다.