Hỏi & Đáp
경고메세지 질문있습니다.
확인을 해보니 reducers/post.js의 dummyPost부분에서 id에 shortId.generate(), 를 적용시켰을때 경고 메세지가 뜨는 것 같습니다. id: 2, 처럼 숫자로 지정하면 경고메세지가 나오지 않습니다. 해결방법이 따로 있을까요 아니면 그냥 넘어가도 될만한 부분일까요?
- Lượt thích
- 1
- Số bình luận
- 2
- Lượt xem
- 314
Hỏi & Đáp
확인을 해보니 reducers/post.js의 dummyPost부분에서 id에 shortId.generate(), 를 적용시켰을때 경고 메세지가 뜨는 것 같습니다. id: 2, 처럼 숫자로 지정하면 경고메세지가 나오지 않습니다. 해결방법이 따로 있을까요 아니면 그냥 넘어가도 될만한 부분일까요?
Hỏi & Đáp
if (turn === 'X') { clickable = false; setTimeout(() => { const emptyCells = rows.flat().filter((v) => !v.textContent); const randomCell = emptyCells[Math.floor(Math.random() * emptyCells.length)]; randomCell.textContent = 'X'; checkWinnerAndDraw (event.target) ; clickable = true; }, 1000); } 보여주신 코드와 비교했을 때 표시한 부분이 달라서 정상적으로 작동하지 않았습니다. 가장 큰 원인은 event.target을 randomCell로 바꾸지 않은 부분인 듯합니다. 강의에서는 위의 코드로 마무리 되어 제가 놓친 것 같습니다. 감사합니다.
Hỏi & Đáp
아래의 코드를 추가하여 원하는 결과는 얻어내었습니다. (2021-10-27) const onClickNumber = ( event ) => { if (! operator ) { numOne += event . target . textContent ; $result . value += event . target . textContent ; return ; } if (! numOne ) { numOne += event . target . textContent * - 1 ; $result . value += event . target . textContent * - 1 ; operator = '' ; $operator . value = '' ; return ; } if (! numTwo ) { $result . value = '' ; } numTwo += event . target . textContent ; $result . value += event . target . textContent ; };