지난 포스팅의 restaurant object에 openingHours를 추가하여 진행해보자! const restaurant = { name: 'Restaurant Name', location: 'Seoul', categories: ['Italian', 'Pizzeria', 'Vegeterian', 'Organic'], starterMenu: ['Foccacia', 'Bruschetta', 'Garlic Bread', 'Caprese Salad'], mainMenu: ['Pizza', 'Pasta', 'Risotto'], openingHours: { thu: { open: 12, close: 22, }, fri: { open: 11, close: 23, }, sat: { open: 0, close: 24..
기본적으로 배열에서 destructuring을 수행한다고 하면 가장 쉽게 이런 방법을 생각 할 수 있다. const arr = [1, 2, 3]; const a = arr[0]; const b = arr[1]; const c = arr[2]; 이렇게 하나하나씩 첫 번째 항목, 두 번째 항목, 세 번째 항목을 각 한 줄 씩 대입해 줄 수 있다. 위의 코드는 간략하게 이렇게 줄일 수 있다. const arr = [1, 2, 3]; const [a, b, c] = arr; 위 코드와 같은 결과를 확인할 수 있다. 오브젝트로 연습하기 다음과 같은 오브젝트를 두고 연습해보자!🏋️♂️🏋️♀️ const restaurant = { name: 'Restaurant Name', location: 'Seoul', ca..