early return

jini.choi·2023년 7월 25일

내가 원하는 조건을 취하기 전에 특정 조건에서 미리 예외처리

 //restaurantList가 객체일때
  const isEmpty = Object.keys(restaurantList).length === 0;
  if (isEmpty) return null;
profile
개발짜🏃‍♀️

0개의 댓글