관리 메뉴

Mini

[Nest JS] 없는 게시물 지울때 예외처리 본문

JS/Nest.js

[Nest JS] 없는 게시물 지울때 예외처리

Mini_96 2024. 8. 17. 20:57
deleteBoard(id:string):void{
  const found = this.getBoardByID(id);
  //filter => 해당 id제외 해서 새로운 boards를 만듬
  this.boards = this.boards.filter((board) => board.id !== found.id);
}