기타/개인 공부2 [JS/REACT] 리액트/바닐라JS 배열 내부 특정 객체 삭제 방법 삭제 1. 불변성 유지 필요 없을 때 - for문과 splice(splice는 기존 배열의 값을 바꾼다) 를 이용한다. const handleDelete = () => { const name = prompt("누구를 삭제하고 싶은가요?"); updatedPerson((person) => { for (let i = 0; i { const name = prom.. 2022. 11. 24. nodejs console.log(req.body) undefined 가 나오는 경우 nodejs의 기초를 공부하며 간단한 채팅 기능을 가진 게시판을 만드는 도중 이상한 문제가 발생했다. $(".chatBtn").click(function (e) { window.location.href = "/chat"; $.ajax({ method: "POST", url: "/chat", data: { writerName: e.target.dataset.writerName, writerId: e.target.dataset.writerId, }, }); }); AJAX를 통해 POST요청을 할 때, req.body로 클릭 태그의 두 개의 dataset을 전달하는 도중, 이상하게 한 dataset은 멀쩡히 사용이 되는 반면 한 dataset은 undefined가 나왔다. 정확히는 writerName은 서버.. 2022. 11. 20. 이전 1 다음